I send emails using the System.Net.Mail. Up till now i have set the mail encoding to utf-8, but now i have to send using ISO-8859-1 encoding. I understand, how I can change the encoding, can I safely change the encoding? What problems could I face changing this?
var email = new MailMessage(from, to)
{
Subject = formManager.ReplaceValuesInString(alert.EmailSubject, replaceValues),
IsBodyHtml = (alert.EmailMode == 2),
BodyEncoding = Encoding.UTF8
};
The main problem I’d expect you to face is that while UTF-8 covers the whole of Unicode, ISO-8859-1 doesn’t – it only has U+0000 to U+00FF (not even that, actually – there’s a “hole” in ISO-8859-1 between U+0080 and U+009F). So if you try to send a text with characters not in ISO-8859-1, that text won’t come through.