Thank you to everyone who responded to this, I received several different
ways to do this, and the solution we chose was provided by Ron Allen
Hornbaker, President/CTO, Humankind Systems, Inc., over on CF-Community...
(you guys should really sign up for the list...it's lots of fun over
there.....)

Here was his answer to the problem along with sample code that I am in the
process of testing and implementing. This is something worth marking for a
future look if you are dealing with clients who send out email newsletters
or any kind of marketing email.

----------------------------------------
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.

===========================
One last thing you should consider. It's pretty common practice to put a
special comment at the top of the HTML message content, so that the few
throwbacks using PINE or other stone-age email client (j/k, no hatemail
from *nix purists please) that doesn't understand multipart MIME won't see
just a boatload of html tags in the message. So, what you'd do is make the
HTML content something like this:

<!--
  If you're reading this, your email software doesn't
  understand html formatting. Please visit our website at

     http://www.ourwebsite.com/newsletter041101.html

  to learn about all the stuff we were trying to tell you.
-->

<html>
<body>
Regular html body here
</body>
</html>
----------------------------------------
Thanks again for all the input, you guys are awesome, as usual!

Erika

"The reward of a thing well done is to have done it." - Ralph Waldo Emerson


-----Original Message-----
From: Erika L Walker [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 10, 2001 1:57 PM
To: CF-Talk
Subject: OT - But Is an Important Topic - Sniffing Email


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...and I do apologize to all you List monitors....I
wouldn't post OT, but I really need the feedback.)

I have a really serious question....and this is a feature that every
customer of mine wants for their email campaigns. And I would love to be
able to offer it to them!

Figuring out which type of email a user's email program can receive without
having them specify a type in the first place.
The general consensus I have gotten is that this is not doable.

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
personalized with any number of offer and message variables. Graphic content
can also be added with ease. The more sophisticated the email, the greater
the chance that the end user may not have the proper systems to read it.
FloNetwork's HTML sensing technology senses whether a recipient's system can
read HTML messages. If not, the system automatically defaults to a plain
text message that can be read.

Our Flo Rich Media application builds the player right into the email. This
means that anyone can read the message, regardless of the software or
hardware they are using. The result is dramatically more compelling
communications that can generate as much as three times the response rate of
plain text email."
-----------------------------------------------------------------------

What are they talking about? How do they do this? Has anybody heard of this?
I can sign up for the demo from them, but they aren't likely to release and
trade secrets to me are they?.....so I am looking for anyone out there that
has any idea about how this is done. Because, I need to do it. I don't care
if I have to learn a new programming language.....this has been one of the
top 5 requests from our client base.

Thanks in advance for your input.


Erika

"The reward of a thing well done is to have done it." - Ralph Waldo Emerson



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

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to