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
"charset" may be any character set registered with IANA. Typically it would be the same charset as the message body.
"encoding" can be either "Q" denoting Q-encoding that is similar to the quoted-printable encoding, or "B" denoting base64 encoding.
"encoded text" is the Q-encoded or base64-encoded text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With