> I figured that subject might grab someone's attention.....
> (I've posted this to every list for maximum exposure, so please
> forgive me
> if you've seen it before)

> Until recently.....this is an excerpt from http://www.flonetwork.com
>
> -----------------------------------------------------------------------
> "HTML graphics-rich email messages get more response than plain text.
> FloNetwork has the technical sophistication to deliver on that premise.
>
> With our Dynamic Personalization application, for example, each
> email can be
> <BIG SNIP>
> What are they talking about? How do they do this?

Erika,

Them durned FloNetwork folks is usin' high-falutin' marketing-speak for a
very common type of email formatting: the multipart-alternative message.
We use it all the time, and so does Amazon, EggHead, and any other
big-time html email newsletter you've ever seen. We learned it by just
examining the headers of newsletters from Amazon, and it's really quite
simple. The receiving mail client will display the HTML version if it can,
and the plain-text version if it cannot. Remember: email is one of the
oldest 'net technologies around, and it's all just plain text (even
attachments). You can examine the full headers and text of messages quite
easily with most email clients.

Here's some CF code that will do it... it expects form imput like you see
in the cfparam's, and will create a multipart/alternative message if
you've provided an HTML body for the message in the form...


================================================================
<cfparam name="Form.from" default="">
<cfparam name="Form.fromalias" default="">
<cfparam name="Form.subject" default="">
<cfparam name="Form.plaintextbody" default="">
<cfparam name="Form.htmlbody" default="">

<cfquery name="Data" datasource="#DS#" username="#DSUsername#"
password="#DSPassword#">
.... your query here to get the recips firstname, email, etc. ...
</cfquery>


<cfif Len(form.htmlbody)>
        <CFSET MIMEBOUNDARY = "----MIME-BOUNDARY----">
        <!--- NO carriage returns in the next two variables --->
        <CFSET contenttype = "multipart/alternative;
boundary="""&MIMEBOUNDARY&"""">
        <CFSET myHeaders = "X-Mailer: ContestClicker Mailer, MIME-Version: 1.0">
        <!--- MUST have carriage returns in the next two variables --->
        <CFSET myPlainMsgTop = "--#MIMEboundary#
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

">
        <CFSET myHTMLMsgTop = "--#MIMEboundary#
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

">
<cfelse>
        <CFSET MIMEBOUNDARY = "">
        <CFSET contenttype = "text/plain">
        <CFSET myHeaders = "X-Mailer: ContestClicker Mailer">
        <CFSET myPlainMsgTop = "">
        <CFSET myHTMLMsgTop = "">
</cfif>

<cfloop query="Data">
<!--- Personalize the messages with data from the query --->
<cfset mySubject = Replace(form.subject,"%firstname%",firstname,"All")>
<cfset mySubject = Replace(mySubject,"%lastname%",lastname,"All")>
<cfset myPlainText =
Replace(form.plaintextbody,"%firstname%",firstname,"All")>
<cfset myPlainText = Replace(myPlainText,"%lastname%",lastname,"All")>
<cfset myHTMLText = Replace(form.htmlbody,"%firstname%",firstname,"All")>
<cfset myHTMLText = Replace(myHTMLText,"%lastname%",lastname,"All")>
<cfset myHTMLText = Replace(myHTMLText,"%email%",emailaddr,"All")>

<!--- Send the messages --->
<CFMAIL To="#emailaddr#"
                 From='"#Form.FromAlias#" <#form.from#>'
                 Server="206.57.37.74"
                 Subject="#mySubject#
Content-type: #contenttype#
#myHeaders#">#myPlainMsgTop##myPlainText#

#myHTMLMsgTop##myHTMLText#
</cfmail>
</cfloop>


<html>
<head>
<title>Messsages Sent</title>
</head>
<body>
<center>
<br><br>
<h2>Done!</h2>
</body>
</html>
==================================================================

The carriage returns, especially after the first and second lines of the
message Subject, are very important... that's how you set custom headers
(like Content-Type: multipart/alternative, etc.) with the <CFMAIL> tag.
The MIME-BOUNDARY can be set to just about any string that's unique.

Hope this helps,

Ron Allen Hornbaker
President/CTO
Humankind Systems, Inc.
http://humankindsystems.com
mailto:[EMAIL PROTECTED]





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-community@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to