Last active
February 24, 2021 17:41
-
-
Save JamoCA/1a8b4b6b55ecb4ba10290c614e36618c to your computer and use it in GitHub Desktop.
Sample CFML to demonstrate Adobe ColdFusion bug CF-420815 (CFMAILPART should ignore WRAPTEXT if TYPE is "html")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- 20210224 Sample CFML to demonstrate Adobe ColdFusion bug CF-420815 (CFMAILPART should ignore WRAPTEXT if TYPE is "html") | |
https://dev.to/gamesover/do-not-use-cfmailpart-wraptext-with-html-3ol0 | |
https://tracker.adobe.com/#/view/CF-4208015 | |
https://gist.github.com/JamoCA/1a8b4b6b55ecb4ba10290c614e36618c | |
---> | |
<CFSAVECONTENT VARIABLE="testHTML"><!DOCTYPE html><html lang="en"><head><title>This is a long title #1. This is a long title #2. This is a long title #3. This is a long title #4. This is a long title #5. This is a long title #6. This is a long title #7. This is a long title #8. This is a long title #9. This is a long title #10. This is a long title #11. This is a long title #12. This is a long title #13. This is a long title #14. This is a long title #15. This is a long title #16. This is a long title #17. This is a long title #18. This is a long title #19. This is a long title #20. This is a long title #21. This is a long title #22. This is a long title #23. This is a long title #24. This is a long title #25. This is a long title #26. This is a long title #27. This is a long title #28. This is a long title #29. This is a long title #30. This is a long title #31. This is a long title #32. This is a long title #33. This is a long title #34. This is a long title #35. This is a long title #36. This is a long title #37. This is a long title #38. This is a long title #39. This is a long title #40.</title></head><body><p>This is a long sentence #1. This is a long sentence #2. This is a long sentence #3. This is a long sentence #4. This is a long sentence #5. This is a long sentence #6. This is a long sentence #7. This is a long sentence #8. This is a long sentence #9. This is a long sentence #10. This is a long sentence #11. This is a long sentence #12. This is a long sentence #13. This is a long sentence #14. This is a long sentence #15. This is a long sentence #16. This is a long sentence #17. This is a long sentence #18. This is a long sentence #19. This is a long sentence #20. This is a long sentence #21. This is a long sentence #22. This is a long sentence #23. This is <span style="font-family:'Times New Roman';">a long sentence</span> #24. This is a long sentence #25. This is a <span style="font-family:'Times New Roman';">long sentence #26</span>. This is a long sentence #27. This is a long sentence #28. This is a long sentence #29. This is a long sentence #30. This is a long sentence #31. This is a long sentence #32. This is a long sentence #33. This is a long sentence #34. This is a long sentence #35. This is a long sentence #36. This is a long sentence #37. This is a long sentence #38. This is a long sentence #39. This is a long sentence #40. This is a long sentence #41. This is a long sentence #42. This is a long sentence #43. This is a long sentence #44. This is a long sentence #45. Done.</p> | |
<h2>ColdFusion CF-420815: CFMAILPART should ignore WRAPTEXT if TYPE is "html"</h2> | |
<p><b>Adobe Tracker:</b> <a href="https://tracker.adobe.com/#/view/CF-4208015">https://tracker.adobe.com/#/view/CF-4208015</a><br> | |
<b>Blog Entry:</b> <a href="https://dev.to/gamesover/do-not-use-cfmailpart-wraptext-with-html-3ol0">https://dev.to/gamesover/do-not-use-cfmailpart-wraptext-with-html-3ol0</a></p> | |
<ol> | |
<li><b>The Internet Message Format RFC 5322</b> (2.1.1. Line Length Limits)<br> | |
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.</li> | |
<li><b>Actual CFMail Result:</b> If "wraptext=900" is used with HTML, the HTML version will wrap indiscriminately near the specified length regardless of the HTML context. This messes with inline CSS styles with spaces.<ol> | |
<li>Long sentence #24 should be rendered in "Times New Roman", but isn't when received by gmail and other MTAs due to forced line wrap.</li> | |
<li>Long sentence #26 is correctly rendered in "Times New Roman", but only because it wasn't randomly located near the <tt>wraptext</tt> limit.</li> | |
</ol></li> | |
<li><b>Expected CFMail Result:</b> The CFMailPart tag should be updated to ignore the <tt>wraptext</tt> parameter if the type is "HTML".<ol> | |
<li>Long sentence #24 is correctly rendered in "Times New Roman".</li> | |
<li>Long sentence #26 is correctly rendered in "Times New Roman".</li> | |
</ol></li> | |
<li><b>Workaround:</b><ol> | |
<li><b>Adobe ColdFusion Developers:</b> Since CFMailPart is not ignoring the <tt>wraptext</tt> value for HTML types, the resulting HTML is negatively impacted. I highly recommend checking your CFML to ensure that the <tt>wraptext</tt> option is not used for HTML content within the CFMAILPART tag.</li> | |
<li><b>Adobe ColdFusion Request:</b> Update the built-in tag to ingore <t>wraptext</th> if the type is "HTML".</li> | |
</ol></li> | |
</ol> | |
</body></html></CFSAVECONTENT> | |
<CFMAIL TO="{toEmail}" from="{fromEmail}" subject="CFMail HTML with WrapText=900 (Actual)" type="html"> | |
<CFMAILPART TYPE="text">View HTML</CFMAILPART> | |
<CFMAILPART TYPE="html" wraptext="900" charset="utf-8"><CFOUTPUT>#testHTML#</CFOUTPUT></CFMAILPART> | |
</CFMAIL> | |
<CFMAIL TO="{toEmail}" from="{fromEmail}" subject="CFMail HTML without WrapText (Expected)" type="html"> | |
<CFMAILPART TYPE="text">View HTML</CFMAILPART> | |
<CFMAILPART TYPE="html" charset="utf-8"><CFOUTPUT>#testHTML#</CFOUTPUT></CFMAILPART> | |
</CFMAIL> | |
<p>Emails has been sent. Check your email and compare/contrast the rendered HTML and source code.</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment