Email mask for MaskedTextBox in C#

Mike picture Mike · Jan 14, 2014 · Viewed 10.6k times · Source

Does anyone have a ready email mask for MaskedTextBox?

e.g.

[email protected] / [email protected] / [email protected] / [email protected] /  

p.s. Please do not suggest RegEx!

Answer

singhm0077 picture singhm0077 · Jan 14, 2014

try this

bool IsValidEmail(string email)
{
    try {
        var mail = new System.Net.Mail.MailAddress(email);
        return true;
    }
    catch {
        return false;
    }
}