Copy link to clipboard
Copied
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 bug has been fixed in CF2016 update 6: Bug fixes in Adobe ColdFusion (2016 release) Update 6
--
Pete Freitag
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
Anyone know if there's been any new information on this? I am running on the latest patch and it still is an issue.
Copy link to clipboard
Copied
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....
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I am curious to know if anyone using the repackaged installer is seeing this issue.I know the repackaged installer came with a newer JRE, and I was curious if somehow it was actually a java bug that caused this.
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
Still happening for me on Product Version:
2016,0,03,300466
Copy link to clipboard
Copied
This bug has been fixed in CF2016 update 6: Bug fixes in Adobe ColdFusion (2016 release) Update 6
--
Pete Freitag