S
Simon Chang
I use System.Net.Mail.MailMessage to send e-mail.
When the subject containt accent and the string is longer then 179 characters.
The receiver of the e-mail get "=?utf-8?B?MSDDqcOpw6kgdGVzdCBEVVAgOiBI..."
in the subject instead of the original subject.
Here is the code :
// Case 1 with problem in the subject: The receiver of the e-mail will
get the next string in the subject
"=?utf-8?B?MSDDqcOpw6kgdGVzdCBEVVAgOiBIMDkwMDAwMDExNSAqKiogZXNzYWkgZCdlbnZveWVyIHVuIGF2aXMgc2FucyBkb3NzaWVyIGRlIHJhdHRhY2hlLjUuLi4uLi4uLi42Li4uLi4uLi4uNy4uLi4uLi4uLjguLi4uLi4uLi45Li4uLi4uLi4uMCAvIGVzc2FpIGQnZW52b3llciB1biBhdmlzIHNhbnMgZG9zc2llciBkZSByYX..."
SendMail("(e-mail address removed)", "(e-mail address removed)", "1 ééé test
DUP : XXXXXXXXXXX *** essai d'envoyer un XXXX sans dossier de
rattache.5.........6.........7.........8.........9.........0 / essai
d'envoyer un XXXX sans dossier de rattache", "testé");
// Case 2 no problem in the subject: The receiver of the e-mail will get
the right string in the subject : 2 é test DUP
SendMail("(e-mail address removed)", "(e-mail address removed)", "2 é test
DUP", "testé");
private void SendMail(string sender, string receiver, string subject,
string body)
{
System.Net.Mail.SmtpClient __smtpClient = null;
__smtpClient = new System.Net.Mail.SmtpClient("....");
using (System.Net.Mail.MailMessage __mailMessage = new
System.Net.Mail.MailMessage(
sender, receiver))
{
__mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
__mailMessage.Subject = subject;
__mailMessage.IsBodyHtml = true;
__mailMessage.Body = body;
__smtpClient.Send(__mailMessage);
}
}
I try different approach by replacing the "é" by [&ecute;] or [/u00EF] or
[É] or [É] but get the same result.
When the subject containt accent and the string is longer then 179 characters.
The receiver of the e-mail get "=?utf-8?B?MSDDqcOpw6kgdGVzdCBEVVAgOiBI..."
in the subject instead of the original subject.
Here is the code :
// Case 1 with problem in the subject: The receiver of the e-mail will
get the next string in the subject
"=?utf-8?B?MSDDqcOpw6kgdGVzdCBEVVAgOiBIMDkwMDAwMDExNSAqKiogZXNzYWkgZCdlbnZveWVyIHVuIGF2aXMgc2FucyBkb3NzaWVyIGRlIHJhdHRhY2hlLjUuLi4uLi4uLi42Li4uLi4uLi4uNy4uLi4uLi4uLjguLi4uLi4uLi45Li4uLi4uLi4uMCAvIGVzc2FpIGQnZW52b3llciB1biBhdmlzIHNhbnMgZG9zc2llciBkZSByYX..."
SendMail("(e-mail address removed)", "(e-mail address removed)", "1 ééé test
DUP : XXXXXXXXXXX *** essai d'envoyer un XXXX sans dossier de
rattache.5.........6.........7.........8.........9.........0 / essai
d'envoyer un XXXX sans dossier de rattache", "testé");
// Case 2 no problem in the subject: The receiver of the e-mail will get
the right string in the subject : 2 é test DUP
SendMail("(e-mail address removed)", "(e-mail address removed)", "2 é test
DUP", "testé");
private void SendMail(string sender, string receiver, string subject,
string body)
{
System.Net.Mail.SmtpClient __smtpClient = null;
__smtpClient = new System.Net.Mail.SmtpClient("....");
using (System.Net.Mail.MailMessage __mailMessage = new
System.Net.Mail.MailMessage(
sender, receiver))
{
__mailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
__mailMessage.Subject = subject;
__mailMessage.IsBodyHtml = true;
__mailMessage.Body = body;
__smtpClient.Send(__mailMessage);
}
}
I try different approach by replacing the "é" by [&ecute;] or [/u00EF] or
[É] or [É] but get the same result.