Does anyone know how to use Chinese characters (or any other special characters) in the template engine provided by SendGrid? I have no problem plugin Chinese characters in subject, html and text properties, they all turn out okay, but when I tried to use AddSubsitute and EnableTempalteengine, all the result (testing email I received) will be bunch of weird characters.
0
votes
1 Answers
0
votes
The SendGrid Template Engine does support unicode (including Chinese characters). To use these however, you'll need to escape them prior to sending them to SendGrid. The escape format SendGrid looks for is Javascript Unicode Escaping as it's a JSON object (e.g. \u4F60\u597D\u4E16\u754C).
To send a substitution with the template engine, you would have an SMTP API parameter something like the followin:
{
"to" : ["[email protected]"],
"sub" : {
"-test-" : [
"\u4F60\u597D\u4E16\u754C"
]
},
"filters": {
"templates": {
"settings": {
"enabled": 1,
"template_id": "5997fcf6-2b9f-484d-acd5-7e9a99f0dc1f"
}
}
}
}