Problem:
You try add sender name to email address, send email via SPUtility.SendEmail. Sender name in email client contains bad characters starting with =?utf-8?B?.
Sample code causing the problem:
... string senderAddress = Web.Site.WebApplication.OutboundMailSenderAddress; string senderName = "Some name with special chars"; // you can use fe. localized web title Web.TitleResource.GetValueForUICulture(receiverCulture) // add rows here string sender = senderName + " <" + senderAddress + ">"; var messageHeaders = new StringDictionary(); messageHeaders.Add("to", receiver); messageHeaders.Add("from", sender); messageHeaders.Add("subject", subject); messageHeaders.Add("content-type", "text/html"); messageHeaders.Add("charset", "utf-8"); result = SPUtility.SendEmail(Web, messageHeaders, emailBody); ...
Solution:
I think you can use SmtpClient to send email and define encoding but I want to use Sharepoint library :-).
So try to encode senderName to base64 encoding and add rows…
var utf8BytesSenderName = Encoding.UTF8.GetBytes(senderName); senderName = "=?utf-8?B?" + Convert.ToBase64String(utf8BytesSenderName) + "?=";