Using EmailValidation in C#

praneetnadkar profile image Praneet Nadkar ・2 min read

Using EmailValidation in C

The other day I was working on the email validations, and I came across this beautifully created nuget package called EmailValidation.

So here’s the link to it.

Now, the MSDN blog page has a short list of a few email addresses that can be used to validate this.

I just copied those and checked. This package works great!

So in a case where someone is looking out for this, try this.

static void Main()

var listOfValidEmails = new List<string>

var listOfInvalidEmails = new List<string>
“Joe Smith <email@domain.com>”,
“email@domain.com (Joe Smith)”,

foreach (var email in listOfValidEmails)
Console.WriteLine($”{email} is {(EmailValidator.Validate(email) ? “valid” : “invalid”)}!”);


foreach (var email in listOfInvalidEmails)
Console.WriteLine($”{email} is {(EmailValidator.Validate(email) ? “valid” : “invalid”)}!”);


This is quicker to use like just import a nuget and you are good to go. In my opinion this covers most of the scenarios for email validation.

One interesting thing I wanted to try is using a regex for all these and then try using pattern matching to check two things. One that all the email scenarios are covered and two, which approach is faster.

Posted on by:

praneetnadkar profile

Praneet Nadkar


Developer. Foodie. Working on .Net tech stack, GraphQL, Azure and AWS.


Editor guide