Showing posts with label email. Show all posts
Showing posts with label email. Show all posts

Wednesday, September 19, 2012

Best Practices for Coding HTML Emails


Design Tips for Email Newsletters  - The big things to look out for when designing or coding an email.

  • Background Images don't work for email clients, you may use a solid background color behind live text.
  • Image Maps cannot be used and are not compatible with many email clients
  • Width 600px
  • all images need style="display:block" for gmail and some other web based clients.
  • No Javascript EVER
  • Inline CSS only and must be basic things like fonts, colors, background colors etc CSS2&3 styles do not apply and cause problems
To be compatible with as many email clients as possible the design created will be sliced and built in HTML table tags. You need to design the html for 10 years ago, yep email clients are old and janky and love nested tables and hate divs and CSS.



Stumble Upon CodePyro

Thursday, December 17, 2009

coldfusion simple email script

Here is a simple Form email script for any generic form. I needed a quick generic email script for a few basic websites on a non coldfusion server to be able to send email through a cf server. So this script takes a form submission from another server and emails it to

. It does check the referers IP address to make sure its a valid request.



<cfset inet_address = CreateObject("java", "java.net.InetAddress")>
<cfset referer= replaceNocase(cgi.HTTP_REFERER,'http://','')/>
<cfset referer= listGetAt(referer,1,'/')/>

<cfset host_IP = listLast(inet_address.getByName(referer),'/')>
<!---required parameters --->
<cfparam name="form.mailfrom" />
<cfparam name="form.mailto" />
<cfparam name="form.mailsubject" />
<cfparam name="form.success" />


<!---check the remote IP address so spammers cant abuse it --->
<cfif host_IP eq "192.168.1.1">
<cfoutput>
<cfmail to="#form.mailto#" from="#form.mailfrom#" subject="form.mailsubject" type="html">

<cfloop collection ="#form#" item="thisAttribute">
#thisAttribute#:#form[thisAttribute]#<br>
</cfloop>
</cfmail>
</cfoutput>

<cflocation url="#form.success#"/>
<cfelse>

wrong ipaddress

</cfif>



I know I know this is not an ideal situation and is pretty insecure. Sometimes you just have to do as the client asks


Stumble Upon CodePyro