I'm facing a problem with the EMailMessage class. Trying to send a plain text OR HTML message works great, even with custom headers for content type and content transfer encoding, e.g. I'm using this for plain text mails: Mail.Headers.AppendHeader("Content-Type","text/plain; charset=UTF-8")
And later to generate the body: Mail.BodyPlainText = EncodeBase64(ReplaceLineEndings(BodyText,EndOfLine.UNIX))
Note: Replacing the line endings is required for any reason, otherwise some mail clients show the entire text as a very, very long line. When just using plain text, it is not required to do this. Any ideas why this happens ?
No additional headers are used when sending HTML mails, just Mail.BodyHTML = TABodyHTML.Text
to create the message (TABodyHTML as TextArea).
However when trying to send a message that contains both, EMailMessage.TextBody and EMailMessage.HTMLBody parts, any additional headers I add myself to specify the encoding fail to work.
I see the main problem that it is impossible for me to adjust the content transfer encoding per message part (so I would use no special settings for HTML but above ones for plain text). Whatever I tried, my headers are overwritten by RB and replaced with standard ones working only with ASCII charset in a reliable way (Apple Mail works, but Thunderbird shows strange characters for German umlauts and other Unicode chars).
What have I missed ? Is there a solution to my problem ? Any notes and comments are highly appreciated (but please, no solutions involving third party plugins or classes, if possible).
Happy New Year 2013 !