Why does MailAddress think 'john@gmail.' is a valid email address?

I think in this case, MS's implementation of a valid email address is incorrect, at least as per RFC822. I haven't actually tried your code, so I'm assuming it does as you say.

There are other ways to validate email addresses, such as actually connecting to the SMTP server and asking it to confirm that the address is valid (as explained here and here). Short of doing that, you will always have a bit of trouble. Personally, I don't think that it's worthwhile to spend too much time validating email address according to some specification (beyond the quick checks we have at our disposal; e.g. your code) - the real test is whether an email is received on that address if you send it. A simple email verification can confirm this, although I know it might not be appropriate in all cases, but in those, you are out of luck.


The MailAddress type has very limited support for validating email addresses and, as of .NET 4.0, does not support most of the related IETF standards. If you need to validate the syntax of your email addresses, possibly without using regular expressions, I suggest you to take a look at EmailVerify.NET, a .NET component that supports all of the current standards about the subject (RFC 1123, RFC 2821, RFC 2822, RFC 3696, RFC 4291, RFC 5321 and RFC 5322). Should you need to, the component even allows to perform additional tests on the addresses, including DNS, SMTP and mailbox checks.

  • EmailVerify.NET website: http://cobisi.com/email-validation/.net-component
  • Online demo: http://cobisi.com/email-validation/validate-address

Disclaimer: I am the lead developer for this product.