Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with CFMAIL tag

Status
Not open for further replies.

cfFran

Programmer
May 30, 2002
64
0
0
US
We are having a problem when ColdFusion replaces two variables inside a CFMAIL tag. If there is no normal text between two variable substitutions, ColdFusion drops the carriage return line feeds that format the text into paragraphs.

I have attached source code which has three examples in it.
1) demonstration of the problem
2) work around by using a period after the first variable
3) replacing the two juxtaposed variables with a work around variable definition

Source Code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
	<TITLE>CFMAIL Test</TITLE>
</HEAD>

<BODY>

<!--- setup some memory variables for this test. Use instead of normal FORM variables --->
<CFSET assignor = "John Q. Assignor"/>
<CFSET actnItemId = 10/>
<CFSET aiTextRev = 2/>
<CFSET actnItemSubj = "The subject line goes here"/>
<CFSET actnReqd = "Perform an analysis of the submitted data item."/>
<CFSET dueDate = "Oct 13, 2005"/> 

<!--- Example One: demonstration of the problem --->
<CFMAIL
   FROM="sender@myCo.com" 
   TO="recipient@yourCo.com" 
   SUBJECT="Example One Test of juxtaposed pound signs">

    Assignor: #VARIABLES.assignor#
 Action Item: #VARIABLES.actnItemId#
    Revision: #VARIABLES.aiTextRev#
Assignment Date: #dateFormat('Oct 09, 2005', "mmm dd, yyyy")#
     Subject: #VARIABLES.actnItemSubj#

#VARIABLES.actnReqd#	

Resubmit a rewrite of your Response to the above Action Item Assignment by 
#VARIABLES.dueDate#.  If you have any questions regarding my disposition action, please 
contact me at your earliest opportunity.

</CFMAIL>

<!--- Example Two: use of period after subject to 'fool' ColdFusion --->
<CFMAIL
   FROM="sender@myCo.com" 
   TO="recipient@yourCo.com" 
   SUBJECT="Example One Test of juxtaposed pound signs">

    Assignor: #VARIABLES.assignor#
 Action Item: #VARIABLES.actnItemId#
    Revision: #VARIABLES.aiTextRev#
Assignment Date: #dateFormat('Oct 09, 2005', "mmm dd, yyyy")#
     Subject: #VARIABLES.actnItemSubj#.

#VARIABLES.actnReqd#	

Resubmit a rewrite of your Response to the above Action Item Assignment by 
#VARIABLES.dueDate#.  If you have any questions regarding my disposition action, please 
contact me at your earliest opportunity.

</CFMAIL>

<!--- Example Three: use of work around variable definition to eliminate the two 
      ColdFusion variables side by side.  This version has no extra, unwanted 
      characters in the email message --->
<CFSET workAroundVar = VARIABLES.actnItemSubj & CHR(10) & CHR(13) & VARIABLES.actnReqd/>
<CFMAIL
   FROM="sender@myCo.com" 
   TO="recipient@yourCo.com" 
   SUBJECT="Example Two Test of juxtaposed pound signs">

    Assignor: #VARIABLES.assignor#
 Action Item: #VARIABLES.actnItemId#
    Revision: #VARIABLES.aiTextRev#
Assignment Date: #dateFormat('Oct 09, 2005', "mmm dd, yyyy")#
     Subject: #workAroundVar#

Resubmit a rewrite of your Response to the above Action Item Assignment by 
#VARIABLES.dueDate#.  If you have any questions regarding my disposition action, please 
contact me at your earliest opportunity.

</CFMAIL>



</BODY>
</HTML>
 
use type = "html" and put <br> in the mail where you want line breaks

We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top