How to use email adresses with special chars such as Ø

Posted by Sir Code-A-Lot on Stack Overflow See other posts from Stack Overflow or by Sir Code-A-Lot
Published on 2010-06-09T11:07:35Z Indexed on 2010/06/09 11:12 UTC
Read the original article Hit count: 221

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about internationalization