Do you know how to validate an email address in C#?

Edit
please tell me which of the following is a valid email address


"Abc\@def"@example.com
"Fred Bloggs"@example.com
"Joe\\Blow"@example.com
"Abc@def"@example.com
customer/department=shipping@example.com
$A12345@example.com
!def!xyz%abc@example.com
_somename@example.com

After taking a read from the RFC, you will find out that all are suppose to be valid email address, yet I am sure most of them will not go through some email validation engine out there!

I learnd these from the article  I Knew How To Validate An Email Address Until I Read The RFC

But what I really want is to valid an email address in C#, this is what I ve found in stack overflow



bool IsValidEmail(string email)
{
    try {
        var addr = new System.Net.Mail.MailAddress(email);
        return true;
    }
    catch {
        return false;
    }
}
Do you know how to validate an email address in C#? Do you know how to validate an email address in C#? Reviewed by DF on 7:01:00 PM Rating: 5
©DF. Powered by Blogger.