We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MailAddress does not seem to accept all valid email address formats

As of Aspose.Network 5.0.0.0 the MailAddress object does not accept certain valid email address formats. For example: firstname lastname"@domain.com would throw an exception as an invalid format "The specified string is not in the form required for an e-mail address."

To be fair, it doesn't work with System.Net.Mail.MailAddress either, however according to ftp://ftp.rfc-editor.org/in-notes/rfc3696.txt that along with a lot of other bizarre stuff is valid. I have seen email addresses formatted this way, and while it is probably not very common, and I personally have serious issues with non-standard characters like spaces etc. in names of things, there are systems that for whatever historical or backward compatible purpose do use these unconventional formats.

While I don't consider this a critical issue, since the email addresses I saw formatted like this came back undeliverable, usually because some mail system along the way did not handle them properly and corrupted the email address, I am mentioning it just in case you would like your product to be robust enough to handle them. It would have saved me some time.

Rick

Hi Rick,

I am sorry I could reproduce the problem at my end with Aspose.Network 5.0.0, .NET framework 2.0/3.5, Windows 7 x64 and Windows XP x86.

Could you please specify which version of Windows OS (x86/64) and .NET framework are you using? “first last@domain.com” should be accepted by MailAddress.

But, there is a way to explicitly ignore email address validation by calling the parametrized constructor as:

MailAddress address = new MailAddress("first name@domain.com"); // does not throw exception
MailAddress address = new MailAddress("first namedomain.com"); // throws exception
MailAddress address = new MailAddress("first namedomain.com", true); // does not throw exception