> I wouldn't mind taking a look at the multipart e-mail
> sender also :). Thanks for the offer

> Daniel Olivares
> WorldWideWebz.com

> Phone:  (760) 268-0504
> Email: [EMAIL PROTECTED]
> <mailto:dco@;worldwidewebz.com>
> URL:  http://www.worldwidewebz.com
> <  mailto:dan@;worldwidewebz.com >


Okay folks, there seems to be much demand for this: ( there better be, it's
a pain to get it working, 'cause there's very little in the way of easy to
find and well described documentation for this )...

here's what's working for me...

<cfparam name="attributes.to" type="string">
<cfparam name="attributes.from" type="string">
<cfparam name="attributes.subject" type="string">
<cfparam name="attributes.text" type="string" default="">
<cfparam name="attributes.html" type="string" default="">
<cfparam name="attributes.server" type="string" default="">
<cfparam name="attributes.boundary" type="string"
default="=_NextPart_.#CreateUUID()#">

<cfmail to="#attributes.to#" from="#attributes.from#"
subject="#attributes.subject#" server="#attributes.server#">
<cfmailparam name="MIME-Version" value="1.0">
<cfmailparam name="Content-Type" value="multipart/alternative;
Boundary=""#attributes.boundary#""">

<cfif len(trim(attributes.text))>
--#attributes.boundary#
Content-Type: text/plain;

#trim(stripcr(attributes.text))#
</cfif>

<cfif len(trim(attributes.html))>
--#attributes.boundary#
Content-Type: text/html;

#trim(stripcr(attributes.html))#
</cfif>

--#attributes.boundary#--
</cfmail>

I use <cfsavecontent> to generate both the plaintext and html text portions
of the message... Had I intended to post this to the devex ( maybe I should
) I would have used 2 tags and use cfassociate to make the syntax something
like

<cfoutput>
<cf_sendmail from=... to=... server=... >

  <cf_mailpart type="text">
    blah blah...
  </cf_mailpart>

  <cf_mailpart type="html">
    blah blah...
  </cf_mailpart>

</cf_sendmail>
</cfoutput>

Of course, the advantages in either case are that with a custom tag wrapper
like this you don't have to deal with setting up the multipart thing every
time you want to use it and it ensures that the text portion is prior to the
html portion ( for older mail readers ), that there's an extra line after
each content type declaration ( yea, don't remove those extra lines --
they're important. ;) Also don't introduce any tabs and don't remove the
extra two hyphens on the end of the last boundary: that's how the client
knows the message is complete.

If you got really creative you could use regex to help format the plain text
part to remove semi-random whitespace. :P

Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to