Special ColdFusion cfmail characters in the subject line

Special characters in the subject line of the mail, which are converted to question marks or fields.

I tried to wrap a dynamic subject line string in URLEncodedFormat, but still in vain.

<cfset strSubject= URLEncodedFormat(s)> <cfmail from=" xxxxx@xx.com " to=" yyyyyyy@yyy.com " subject="#strSubject#" type="html" > #testText# </cfmail> 
+4
source share
2 answers

Assuming the special characters are unicode characters, you will need to encode the string in base64 format and use it in the subject line. Like this,

 <cfset strSubject="Demande d'chantillons supplémentaires"> <cfset strSubject=ToBase64(strSubject, "utf-8")> <cfmail from=" test@test.com " to=" test@test.com " subject="=?utf-8?B?#strSubject#?=" type="html"> #testText# </cfmail> 

The subject line should be in the format =?<charset>?<encoding>?<encoded text>?=

Wanted ? and = .

MIME - coded word

" charset " can be any character set registered with IANA. typically it will be the same encoding as the message body.

" encoding " can be either "Q" denoting Q encoding, which is similar to the encoded quotation mark encoding, or "B" denoting base64 encoding.

"Encoded text" - a text-encoded Q or base64.

+7
source

Also: add charset = "utf-8" to the cfmail tag. If you use utf-8 in a theme, you will probably also use it in the body.

0
source

Source: https://habr.com/ru/post/1397579/


All Articles