문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top