本文介绍了ColdFusion中cfmail特殊字符的主题行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 邮件主题行中的特殊字符已转换为问号或框。 我试图将主题行的动态字符串包装在URLEncodedFormat中,但最终无效。 < cfset strSubject = URLEncodedFormat(s)> < cfmail from [email protected] to [email protected] subject =#strSubject# type = html> #testText#< / cfmail> 解决方案假设特殊字符是unicode字符,将字符串编码为base64格式并在主题行中使用。像这样, < cfset strSubject =Demande d'chantillonssupplémentaires> < cfset strSubject = ToBase64(strSubject,utf-8)> < cfmail from [email protected] [email protected] ==?utf-8?B?#strSubject#?=type =html > #testText#< / cfmail> 主题行的格式必须为 =?< charset> ;? < encoding>?< encoded text>?= ? = 是必填项。 MIME - 编码字 Special characters in the subject line of the mail getting converted in to question marks or boxes.I have tried to wrap the dynamic string of the subject line in URLEncodedFormat , however ended up in vain.<cfset strSubject= URLEncodedFormat(s)><cfmail from="[email protected]" to="[email protected]" subject="#strSubject#" type="html"> #testText#</cfmail> 解决方案 Assuming the special characters are unicode charactes, you will have to encode the string to a base64 format and use that in the subject line. Like this,<cfset strSubject="Demande d’chantillons supplémentaires"><cfset strSubject=ToBase64(strSubject, "utf-8")><cfmail from="[email protected]" to="[email protected]" subject="=?utf-8?B?#strSubject#?=" type="html"> #testText#</cfmail>The subject line must be in the format =?<charset>?<encoding>?<encoded text>?=The ? and = are required.MIME - Encoded Word 这篇关于ColdFusion中cfmail特殊字符的主题行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-27 14:55