Seth,
    That is awesome!  I hope it works.  If so it will be a very handy bit of
code.  I will try it out and see.

Thanks,
    Brett

----- Original Message -----
From: "Seth Bienek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 24, 2001 1:32 PM
Subject: RE: <CFMAIL - HTML or Plain Text



> comments would be great!!!

I forgot to mention that this method can be used to send multiple
attachments with HTML formatted emails as well.  Just use the ToBase64
function to convert your binary file(s) to text, then put each one in it's
own section.

Here's the commented code --

<!--- Create a unique ID for the message boundary. --->
<cfset boundary = CreateUUID()>
<!--- Standard CFMAIL.. Note that the TYPE attribute is not set. --->
<cfmail to="[EMAIL PROTECTED]" from="[EMAIL PROTECTED]" subject="test">
<!--- This message is going to be a multipart message.  Since an email is
really just a really long string of text, we need a unique substring to use
as a seperator between the parts.  Just to make sure that a seperator
doesn't accidentally get typed in, I like to use a UUID - the odds of this
exact string accidentally coming through in an email would be extremely
rare.  The mailparam tag will insert the value of the seperator into the
mail header, as well as telling the email client that this message is
composed of more than one part. --->
<cfmailparam name="Content-Type" value="multipart/alternative;
boundary=""#boundary#""">
<!--- Boundaries are always preceded by "--".  Each part of a multi-part
message is preceded by a boundary.  The boundary value MUST match the value
set in the header. --->
--#boundary#
<!--- Each section of the email gets it's own mini-header.  This header
tells the mail client what kind of data follows (plain text, 8 bit, in this
case), and is always seperated from the content that follows by one empty
line. --->
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

This is the plain text message for the email.
<!--- Every section gets a header, and every header begins with the same
exact Boundary value.  --->
--#boundary#
<!--- Modern mail clients that support HTML email will ignore a plain text
section of an email if there is also an HTML section.  Note the empty line
between the secion header and the content that follows it. --->
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!--- HTML formatted emails should generally be treated the same as html
pages.  Javascript is not allowed, however. The "title" tags are not
supported in most mail readers, but should be used anyway. --->
<html>
<head>
<title>HTML Message</title>
</head>
<body>
This is the HTML text message for the email.
</body>
</html>
<!--- the final boundary is always followed by two hyphens.  This is how the
email client knows that the message is complete, and not to expect another
section. --->
--#boundary#--
</cfmail>


Regards,

Seth

------------------------------
Seth Bienek
Solutions Development Manager
Stonebridge Technologies, Inc.
972.455.7294 tel
972.404.9754 fax
ICQ #7673959
------------------------------



-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org



-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to