hi guys,
the following functions works fine.. you might take out the error handling
bit...
sorry about the copy and paste..
ok it works.. fine... BUT.. we have a slight problem in that... when the
user views the email they get a single line of or similar..
"--CD6B6C5801050BBB32E7E24F6AE7A765 "
at the end of the emai...
the way around this is to use the Java function thats available to send out
emails.. rather than you cfmail...:(
<cffunction name="HTMLMail" hint="Sends multipart HTML/Plain text email"
access="public" output="Yes">
<cfargument name="To" type="string" required="Yes">
<cfargument name="From" type="string" required="Yes">
<cfargument name="Subject" type="string" required="Yes">
<cfargument name="TextMessage" type="string" required="Yes">
<cfargument name="HTMLMessage" type="string" required="Yes">
<cfargument name="CC" type="string" required="No" default="">
<cfargument name="Mode" type="string" required="No" default=""> <!---
Set
to 'Display' for testing --->
<!--- Declare local variables --->
<cfset var CR = Chr(13)&Chr(10)>
<cfset var MIMEboundary = "ContentBoundary">
<cfset var CustomHeader = "multipart/alternative; boundary=" & CHR(34)
&
MIMEboundary & CHR(34)>
<cfset var stReturn = StructNew()>
<cfset stReturn.ReturnCode = 1>
<cfset stReturn.ErrorMessage = "">
<!--- If in display mode, just output message to page --->
<cfif arguments.Mode EQ "Display">
<cfoutput>
To: #arguments.to#<br>
CC: #arguments.cc#<br>
From: #arguments.from#<br>
Subject: #arguments.subject#
<p>
-------- Text Message --------<br>
<pre>#arguments.TextMessage#</pre>
<p>
-------- HTML Message --------<br>
#arguments.HTMLMessage#<p>
</cfoutput>
<cfelse> <!--- Otherwise, send email (No indenting allowed) --->
<cftry>
<cfmail
to="#arguments.to#"
cc="#arguments.cc#"
from="#arguments.from#"
subject="#arguments.subject#">
<cfmailparam name="Content-Type" value="#CustomHeader#">
--#MIMEboundary#
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
#arguments.TextMessage#
--#MIMEboundary#
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
#arguments.HTMLMessage#
--#MIMEboundary#--
</cfmail>
<cfcatch>
<cfset stReturn.ReturnCode = 0>
<cfset stReturn.ErrorMessage = "Error occurred while sending
HTML
email.<br>">
<cfset CFCErrorMessage = "[CFC=email | Method=HTMLMail] :
(#stReturn.ErrorMessage#)"><!--- Global Private Variable to hold CFC
Specific Errors --->
<cfinclude template="../includes/inc_errormessage.cfm">
</cfcatch>
</cftry>
</cfif>
<cfreturn stReturn>
</cffunction>
hth
joel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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