Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need help on carriage return / line feed...

Contributor ,
Jul 18, 2007 Jul 18, 2007
Hi,

I have a variable defined for a new line, e.g. <CFSET NewLine = "#chr(13)##chr(10)#">, that I use as a break between lines of text within CFMAIL.

<CFSET Message = NewLine & "Product Name: " & Trim(GetProduct.ProductName) & NewLine>
<CFSET Message = Message & "Product Description: " & Trim(GetProduct.ProductDesc) & NewLine>
<CFSET Message = Message & "Product Color: " & Trim(GetProduct.ProductColor) & NewLine>

<CFMAIL FROM="MyEmailAddress@MyDomain.com" TO="SomeOne@SomeCompany.com" SUBJECT="Product Info">#Message#</CFMAIL>

If the email is sent to and open up in Microsoft Outlook account (mailbox), the "Product Description" line of text would stay on the same line as the Product Name (when LEN(GetProduct.ProductName) > 50). In other words, the NewLine variable is not doing the break. The code works with yahoo or hotmail account though.

Any advice is greatly appreciated.

Thanks in advance!




TOPICS
Getting started
971
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Jul 26, 2007 Jul 26, 2007
The trick is to add 3 blank spaces (" " ) at the end of each line but before the break (NewLine) such as these:

<CFSET NewLine = "#chr(13)##chr(10)#">

<CFSET Message = NewLine & "Product Name: " & Trim(GetProduct.ProductName) & " " & NewLine>
<CFSET Message = Message & "Product Description: " & Trim(GetProduct.ProductDesc) & " " & NewLine>
<CFSET Message = Message & "Product Color: " & Trim(GetProduct.ProductColor) & NewLine>

<CFMAIL FROM="MyEmailAddress@MyDomain.com" TO="SomeOne@SomeCompany....
Translate
Guest
Jul 19, 2007 Jul 19, 2007
It is likely the e-mail is being interpreted as HTML, so 13-10 does not do the job. Try this:
<CFSET NewLine = "<BR>">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 23, 2007 Jul 23, 2007
No, <CFSET NewLine = "<BR>"> won't work. It only happens to Outlook, so I'll just live with it.

Thanks for your help anyway!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 26, 2007 Jul 26, 2007
LATEST
The trick is to add 3 blank spaces (" " ) at the end of each line but before the break (NewLine) such as these:

<CFSET NewLine = "#chr(13)##chr(10)#">

<CFSET Message = NewLine & "Product Name: " & Trim(GetProduct.ProductName) & " " & NewLine>
<CFSET Message = Message & "Product Description: " & Trim(GetProduct.ProductDesc) & " " & NewLine>
<CFSET Message = Message & "Product Color: " & Trim(GetProduct.ProductColor) & NewLine>

<CFMAIL FROM="MyEmailAddress@MyDomain.com" TO="SomeOne@SomeCompany.com" SUBJECT="Product Info">#Message#</CFMAIL>



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources