.Net MailAddress fails on "ñ" in email address
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.
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).
精彩评论