Skip to main content
charlesp36266952
New Participant
August 28, 2016
Answered

CFMAIL Stripping Spaces in Release 2016

  • August 28, 2016
  • 6 replies
  • 1681 views

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 has been closed for replies.
Correct answer pete_freitag

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

--

Pete Freitag

Foundeo Inc.

6 replies

pete_freitag
pete_freitagCorrect answer
Participating Frequently
August 31, 2018

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

--

Pete Freitag

Foundeo Inc.

Participating Frequently
September 3, 2017

Still happening for me on Product Version:

     2016,0,03,300466

New Participant
February 23, 2017

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>

Participating Frequently
September 3, 2017

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>

troy.jones.twd
New Participant
February 8, 2017

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

New Participant
February 8, 2017

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....

troy.jones.twd
New Participant
February 8, 2017

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

EddieLotter
Inspiring
September 6, 2016

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!

New Participant
August 31, 2016

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?

Aces__n_Eights
New Participant
September 7, 2016

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.