We encountered a strange issue this week where client-provided HTML wasn't being displayed consistently in all email clients. Some of the received message text was being displayed incorrectly, but it appeared correct when previewed prior to being sent.
After reviewing their HTML and experimenting with a global email handler that we've used for years, we determined it was due to using aWRAPTEXT
parameter on theCFMailPart tag. One example was an inline CSS rule that used the font "Times Roman". The wraptext option would occasionally insert a line break in the midst of the font name due to the context-insensitive wordwrap logic.
I'm not sure if this is a bug, but it seems like one. (I've reported it.Bug CF-4208015) We've used this parameter for years under the assumption that it would correctly wrap long HTML to ensure that it's compliant. We incorrectly assumed that addingwraptext="900"
would help ensure that long HTML lines would be safely wrapped. I'm pretty sure that this was tested a one point in the past, but we've been using Coldfusion since v3 and we keep discovering built-in functions behaving a little differently (ie, incorrectly) in newer versions.
The Internet Message Format RFC5322
2.1.1. Line Length Limits
There are two limits that this standard places on the number of characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF.
Comparison of Generated HTML Screenshot
Here's what the resultant HTML looks like when delivered to a Gmail address.(NOTE: The right-side is supposed to indicate "900 characters". I used the VSCodeRender Line Endings extension so that the end-of-line characters would be visible.)
Solution / Work-Around
The MailPart tag should probably be updated to ignore thewraptext
parameter if the type is "HTML". Since it's not ignoring the value and using it negatively impacts the resultant HTML, we highly recommend checking your CFML code to ensure that this option is not used for HTML content within the CFMAILPART tag.
<!--- HTML wrapped correctly; short 76 character lines delimited with "=" ---><cfmailparttype="html"charset="utf-8">#myHTML#</cfmailpart><!--- HTML wrapped incorrectly; long ~900 character lines ---><cfmailparttype="html"wraptext="900"charset="utf-8">#myHTML#</cfmailpart>
Top comments(3)

- LocationMonterey, CA
- WorkWeb Applications Developer
- Joined
This ticket has been flagged as "fixed" on 2023-07-02. If Adobe does what they've always done, this fix will soon be added to either the latest release (CF2023) or the next one. (I'm hoping they update both CF2018 & CF2021 since neither are EOL.)

I've been running into this issue withCFMailPart
on Lucee 5.2 every since we converted. There's a bug in Lucee in which it ignores thewraptext
value. It's been updated in later releases of Lucee; but, I haven't been able to upgrade yet. It's showing up in the exact same way for us - the inlinestyle
attributes are breaking in strange places. I've been trying to find ways to make sure the breaks happen in more predictable ways; but, it hasn't been a high-priority at work :(
Really, I Just need to upgrade Lucee!!

- LocationMonterey, CA
- WorkWeb Applications Developer
- Joined
I never realized that anyone from ACF changed the status and commented.
tracker.adobe.com/#/view/CF-4208015
Here's my proof-of-concept to reproduce the error:
gist.github.com/JamoCA/1a8b4b6b55e...
For further actions, you may consider blocking this person and/orreporting abuse