Check that email address is valid for System.Net.Mail.MailAddress
Currently, to avoid errors from being thrown up due to invalid email addresses, I do the following:
Currently, to avoid errors from being thrown up due to invalid email addresses, I do the following:
All we are really doing is comparing the input string to one
gigantic regular expression. But building that regexp, and
ensuring its correctness, is made much easier by assembling it
from the “tokens” defined by the RFC. Each of these tokens is
tested in the accompanying unit test file.