Question

We are using SmtpClient.Send to send mail. But unfortunately the mail body which is having some special character like "æ", "ø" and "å" (and many such) are not getting send properly and on reciept those character is getting corrupted.

Any help will be appreciated.

Regards, Paddy

Was it helpful?

Solution

The default encoding used by SmtpClient.Send is us-ascii. You need to use the override that receives a MailMessage and set the message's BodyEncoding property to an encoding that contains the special characters you need. You can do the same for the SubjectEncoding property, to encode special characters in the Subject.

You can use a Unicode encoding but the documentation warns that your message's TransferEncoding will be converted to Base64. Almost all email clients can handle this, so I don't thing this will be an issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top