KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to send emails that contain non-ASCII characters using the SmtpClient and MailMessage classes. I am using an external mailing service ( MailChimp ) and some of my emails have been rejected by their SMTP server. I have contacted them and this is what they replied: It appears the subject line is being Base64 encoded and then Quoted-Printable encoded, which generally should be fine, but one of the characters is being broken across two lines. So when your subject lines are a bit longer, in order to be processed correctly, it's broken on to two lines. When using UTF-8 quoted printable in a subject line, character strings aren't supposed to be broken between lines. Instead a line should be shorted so that the full character string remains together. In this case, that's not happening, so the string of characters that represents a single character is being broken across multiple lines, and therefore isn't validly UTF-8 quoted-printable encoded. The problematic subject is the following: Subject: XXXXXXX - 5 personnes vous ont nommé guide Which is, in UTF-8/Base64: Subject: WFhYWFhYWCAtIDUgcGVyc29ubmVzIHZvdXMgb250IG5vbW3DqSBndWlkZQ== Because that header would exceed a certain maximum length (I am unsure whether it is the Quoted-Printable encoding and its limit of 76 characters per line, or the SMTP header limit), after encoding and split, the header will become: Subject: =?utf-8?B?WFhYWFhYWCAtIDUgcGVyc29ubmVzIHZvdXMgb250IG5vbW3D?= =?utf-8?B?qSBndWlkZQ==?= Apparently this causes an issue when decoding (because the first line cannot be decoded to a valid string). I am not sure I fully understand the problem, and I have the following questions: Why is the ?utf-8?B? part repeated? Shouldn't the QP encoding happen before splitting the line
Tags (comma-separated)
Save Edits
Cancel