[thelist] Tip: cfmail and linux

Frank frank at loofahcom.com
Fri May 25 17:16:42 CDT 2001


<tip type="Work Arounds" author="Frank Marion">

Cold Fusion server 4.5.1sp2 has a bug in how it creates an email to send. 
It fails to add a carriage return before a line feed, thus will fail on 
strict email servers such as qMail.

<!--- First, set the body of the email to a variable --->
<cfset UserMail="

The body of your message goes here

with an #variables# or code that you want to include in the body of your email.

And maybe your sig.
">

<!--- Create a proper line ending--->
    <cfset LineFeed="#chr(10)#">
    <cfset CRLF="#chr(13)##chr(10)#">

<!--- Now we finally send the email to the recipient. --->
    <cfmail
           to="#UserEmail#"
           from="#RecipientEmail#"
           subject="Subject goes here"
           server="#MailServerIP#">#Replace("#UserMail#", "#LineFeed#", 
"#CRLF#", "All")##CRLF#</cfmail>


Note that there is absolutely nothing between the the start and end tag 
other than the processed body variable. If you put even a one line between 
it, this work around will fail.

Good luck!
</tip>





More information about the thelist mailing list