Hi,
I'm using migrationsample.cs to create a mail in a mailbox using the mail migration APIs.
I'm experiencing problems with accentued characters in the message that become unreadable after migration.
I've managed to handle it encoding the message to base64 before send but the doc says that it's deprecated.
Furthermore, the migrated mail is not using quoted-printable chars like when I receive a mail from another mail application.
Could you post a sample or explain what is the proper way to manage them?
Below is the current solution.
// RFC 822 email message to migrate.
private const string rfcTxt =
"Received: by 10.143.160.15 with HTTP; Mon, 16 Jul 2007 10:12:26 -0700 (PDT)\r\n" +
"Date: Mon, 16 Jul 2007 10:12:26 -0700\r\n" +
"Subject: hébé Subject \r\n" +
"MIME-Version: 1.0\r\n" +
"Content-Type: text/plain; charset=utf-8\r\n" +
"Content-Transfer-Encoding: quoted-printable\r\n" +
"Content-Disposition: inline\r\n" +
"\r\n" +
"ééé\r\n" +
"\r\n";
static public string EncodeTo64(string toEncode)
{
Encoding enc = new UTF8Encoding(true, true);
byte[] bytes = enc.GetBytes(rfcTxt);
string returnValue = System.Convert.ToBase64String(bytes);
return returnValue;
}
private static string GenerateRandomRfcText()
{
[...]
return EncodeTo64(result);
}
private static MailItemEntry SetupMailItemEntry(string batchId)
{
[...]
entry.Rfc822Msg = new Rfc822MsgElement(GenerateRandomRfcText());
entry.Rfc822Msg.MessageEncoding = Rfc822MsgElement.EncodingMethod.BASE64;
}