Reputation: 918
The following code throws an exception of "An invalid character was found in the mail header: 'ñ'.":
string email = "ñ@c.com";
MailAddress to = new MailAddress(email);
The actual address I'm running into this is a valid address, but the MailAddress class throws an error whenever I try and use it.
Upvotes: 9
Views: 2488
Reputation: 55152
Yeah, interesting. According to Wikipedia: Email Address, it's strictly defined as being a subset of ASCII, so that is technically invalid.
So, it seems you just strictly can't send email to that address from .NET (using the System.Net.Mail classes, anyway).
Upvotes: 6