subject encoding issues

outlook email encoding problem
utf-8 recipient address not supported

I try to send emails with my dedicated office365 account but I have issues with subject encoding - all my special characters are replaced with "?".

Code I use is pretty simple and works fine with different test account at

using (var mailMsg = new MailMessage(sender, recipient))
    mailMsg.IsBodyHtml = true;
    mailMsg.Subject = "Hello world żółćąź";
    mailMsg.Body = body;

    using (var smtpClient = new SmtpClient())
        smtpClient.Credentials = new NetworkCredential("email", "password");
        smtpClient.EnableSsl = true;
        smtpClient.Host = "";
        smtpClient.Port = 587;

        await smtpClient.SendMailAsync(mailMsg);

I tried to set all possible subject encoding with no luck. Also converting subject string to Base64String also don't work. Also tried to set Content-Type header charset... All of the resolutions I found didn't help me. Maybe this is some specific SmtpClient issue realated only with office365?

And also setting the body encoding did not help

mailMsg.BodyEncoding = Encoding.UTF8;

I had the same issue with my company's account. Here are my findings so far:

It looks like the Office365 e-mail servers enabled the SMTPUTF8 extension a few months ago which changes the behavior of the System.Net.Mail.SmtpClient class into sending different SMTP commands and a different DATA payload.

In my case the message would always arrive fine when sent to another Office365 account but for other accounts we received e-mail bounce notices from the remote SMTP server which accepted the relayed e-mail message from Office365. The error was something like "Invalid data received, expected 7-bit-safe characters". I could thus imagine that the remote SMTP server from the OP might silently replace all characters outside the low 7-bit range with a question mark.

Sending through GMail (which also has the SMTPUTF8 extension active) had no problems.

So far I haven't debugged the SmtpClient reference sources yet to see what gets sent to the Office365 server. The root cause could thus either be that SmtpClient sends a good message which Office365 "corrupts" before relaying and which GMail sends on without issue; or SmtpClient builds a bad message / SMTP session which Office365 silently accepts and forwards to remote SMTP servers but which GMail accepts and fixes on the fly before relaying.

Either way, I pulled in the MailKit and MimeKit libraries using NuGet and use those instead to send my e-mails. These offer SMTP protocol logging to troubleshoot issues and appear to solve the stated problem by properly sending the SMTPUTF8 and 8BITMIME flags as defined in RFC 6531. It does take extra work to read configuration from the usual Web.config or App.config location but the libraries do the job.

If you want to keep using SmtpClient then you should either contact Microsoft (it's their service and their .NET Runtime), or run your own private SMTP server without the SMTPUTF8 extension which relays to remote servers. In the latter case SmtpClient should properly encode all headers and payload (though it does mean that you might be unable to use the International value for the DeliveryFormat property when you want to send to people with an internationalized e-mail address).

Message encoding options in Exchange Server, Typically, the default settings for these message encoding options will work fine. from your Exchange environment appear to have formatting issues. the value of the charset= setting in the MIME Content-Type: header field. I try to send emails with my dedicated office365 account but I have issues with subject encoding - all my special characters are replaced with "?". Code I use is pretty simple and works fine with different test account at

Set the encoding of the mail message so one that supports the characters you use, since the default is us-ascii:

mailMsg.BodyEncoding = Encoding.UTF8;

mails are not going with smtp details implemented in PHP, Hi Team, Please check why the mails are not going from SMTP details text/html​; charset=UTF-8 Content-Transfer-Encoding: 8bit [message] =>hi you are using SMTP Authenticated submission to relay emails through Office 365. Here's an article you can refer to and hope it may help with your issue:  Tech support scams are an industry-wide issue where scammers trick you into paying for unnecessary technical support services. You can help protect yourself from scammers by verifying that the contact is a Microsoft Agent or Microsoft Employee and that the phone number is an official Microsoft global customer service number.

We had the same Issue with Office365 SMTP Server, using vmime library. We solved it by disabling SMTPUTF8, thus always encoding non-ascii characters.

As stated above by JBert, the same protocol works with GMail SMTP servers.

3 steps to correct message encoding in emails, Applies to: CodeTwo Email Signatures for Email Clients CodeTwo Email Signatures for Office 365 1.x CodeTwo Exchange Rules 2.x, 3.x  Use Telnet to test SMTP communication on Exchange servers. 2/8/2020; 10 minutes to read +3; In this article. You can use Telnet to test Simple Mail Transfer Protocol (SMTP) communication between messaging servers. SMTP is the protocol that's used to send email messages from one messaging server to another.

MailMessage Subject encoding does not work if an attachment , MailMessage Subject encoding does not work if an attachment added When I add an furkanhb opened this issue on Nov 26, 2018 · 8 comments works fine using (SmtpClient smtp = new SmtpClient("", 587)) { smtp. The message encoding options in Exchange Server let you specify message characteristics such as MIME and non-MIME character sets, binary encoding, and attachment formats. You can specify message encoding options in the following locations: Internet recipient message format (Outlook 2010 or earlier) Outlook on the web (formerly known as Outlook

smtpclient.sendmailasync ignores subject encoding while .send , At best, it's irritating to get an email that contains unreadable characters. At worst, it can prevent you from reading the mail at all. Sometimes  Hey guys, I'm trying to connect to Office365 using the settings given by Server: Port: 587 Security: TLS I tried that but when I use TLS it doesn't connect and when I use STARTTLS I get a Couldn'

How to Change the Character Encoding in Outlook, Configure SMTP to run against an Office 365 tenant. 2. a mail with a Posted Sales Invoice in PDF format with a correctly encoded subject line. MailMessage Subject encoding does not work if an attachment added. When I add an attachment to MailMessage object and subject contains unicode characters such as "İ", mail subject text encoding does not work. No problem, if no attachment is added. Ex: When i set Subject property as "20 İstanbul" mail subject is "20 Ä°stanbul"

  • Downvote: you are setting the body encoding when the question was clearly about the subject. Also note that the question did state that all kinds of encoding properties were tried.