Skip to main content
charlesp36266952
Participant
Aug 28, 2016 1:02 PM UTC
Answered

CFMAIL Stripping Spaces in Release 2016

We recently upgraded to ColdFusion 2016 having run ColdFusion for over a decade.  Most everything has gone well except a weird issue with email.  Every CFMAIL function now strips out spaces when displaying multiple variables in a row. 

For example, many automated reports that generated output through CFMAIL have something like this in the code:

Example Query:

<cfquery name="GetUsers" datasource="database">

     Select User_Name_F, User_Name_L

     From Users

     Where Active = 1

     Order By User_Name_L, User_Name_F

</cfquery>

Output Code (in body of CFMAIL tag):

<cfoutput>#GetUsers.User_Name_F# #GetUsers.User_Name_L#</cfoutput>

Output Result (in multiple email clients):

JohnDoe

Before the upgrade this displayed as "John Doe" correctly with the space between names and has for years.  I can force a blank space by hard-coding it in, which I shouldn't have to do.  I can also do a "Select (User_Name_F + ' ' + User_Name_L) as name" and make it work, but many times I will use the first and last names in different orders in the same output, so I shouldn't have to do this either.  The same issue occurs from queries from MySQL 5 and Microsoft SQL Server.  The same issue occurs with variables from queries as well as variables created using CFSET. 

Is this a bug?  What am I missing?

Thanks!

This topic is closed to new replies. Start a new post to keep the conversation going.
pete_freitag
pete_freitagCorrect answer
Participating Frequently
Aug 31, 2018 7:00 PM UTC

This bug has been fixed in CF2016 update 6: Bug fixes in Adobe ColdFusion (2016 release) Update 6

--

Pete Freitag

Foundeo Inc.

11 replies

pete_freitag
pete_freitagCorrect answer
Participating Frequently
Aug 31, 2018 7:00 PM UTC

This bug has been fixed in CF2016 update 6: Bug fixes in Adobe ColdFusion (2016 release) Update 6

--

Pete Freitag

Foundeo Inc.

Translate
Participating Frequently
Sep 3, 2017 6:31 PM UTC

Still happening for me on Product Version:

     2016,0,03,300466

Translate
Participant
Feb 23, 2017 5:14 PM UTC

Found a hack in the meantime.  If you use CFINCLUDE for the body of the CFMAIL, it will properly handle the content.

Note that you must include a CFOUTPUT inside the include.

<cfmail from="a@b.com" to="b@a.com" type="html" subject="I Fixed It!">

     <cfinclude template="MyEmailConent.cfm">

</cfmail>

MyEmailContent.cfm:

<cfoutput>

   #var1# #var2# #var3#

</cfoutput>

Translate
Participating Frequently
Sep 3, 2017 6:50 PM UTC

You can also fix it with cfsavecontent to avoid needing a separate file...

<cfsavecontent variable="request.emailBody" >

     <cfoutput>

          <pre>

Email:  #request.email#

Name:   #request.name_first# #request.name_last#

          </pre>

     </cfoutput>

</cfsavecontent>

<cfmail from="me@gmail.com" to="you@gmail.com" subject="Test Email">

#request.emailBody#

</cfmail>

Translate
troy.jones.twd
Participant
Feb 8, 2017 8:51 PM UTC

Anyone know if there's been any new information on this? I am running on the latest patch and it still is an issue.

Translate
Participant
Feb 8, 2017 9:18 PM UTC

Yep, still an issue with update 3. Adobe claims its fixed in the bug tracker but doesn't say what version its fixed in.  I'm thinking maybe the fix may have just missed making it into  update 3 so I expected Update 4 (I was guessing around December) would have it, but in December they put out a repackaged installer instead.  So maybe in March we will get Update 4 which HOPEFULLY will contain the fix, but its all just speculation (and hope) on my part.  Waaaay too long to wait for a much needed simple fix though....

Translate
troy.jones.twd
Participant
Feb 8, 2017 9:22 PM UTC

Agreed, and this is something that is a bit perplexing as to why it even exists. I've employed the   workaround with limited success but that only seems to help in specific isolated cases.

Guess we can just hurry up and wait

Translate
EddieLotter
Inspiring
Sep 6, 2016 5:11 PM UTC

As a temporary work-around, would using a non-breaking space be acceptable?

<cfoutput>#GetUsers.User_Name_F#& nbsp;#GetUsers.User_Name_L#</cfoutput>

Cheers

Eddie

P.S. Sorry, the editor interprets the nbsp and doesn't show it. I inserted a space to defeat it!

Translate
Participant
Aug 31, 2016 1:01 PM UTC

We are seeing the same behavior after moving to CF 2016, but you are further ahead in your troubleshooting.  Did you file file a bug report at bugbase.adobe.com?

Translate
Aces__n_Eights
Participant
Sep 7, 2016 11:57 AM UTC

Just an FYI - I have a report in adobe's bugbase (4187127) that has been verified and is slated to be fixed. When that happens though - who knows.

Translate