How to use email adresses with special chars such as Ø
- by Sir Code-A-Lot
By writing this:
var recipient = new MailAddress("name@abcø.dk");
Notice the "ø" in the domain part.
I get an exception stating:
System.FormatException: The specified string is not in the form required for an e-mail address.
at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName)
at System.Net.Mail.MailAddress.ParseValue(String address)
at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
at System.Net.Mail.MailAddress..ctor(String address)
The address used should be perfectly valid.
So I'm guessing I have to encode the address somehow?