Ask a questionAsk a question
 

Answeremail address verification

Answers

  • Tuesday, October 03, 2006 4:19 PMahmedilyasMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    you would do some Regex on it, regular expressions, checking the field of the email address. If Regex returns true then email address is valid so continue, otherwise its false and there is an error so notify the user.



    Regex theEmailValidator = new Regex(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3} \.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)"); //"(?<user>[^@]+)@(?<host>.+)");

    Match emailMatch = theEmailValidator.Match(EmailAddressHere);
    if (!emailMatch.Success)
    {    
        return false;
    }
    else
    {  
       return true;
    }

     

     

    There are a few Regex patterns, this one is what I use and works well

All Replies

  • Tuesday, October 03, 2006 4:19 PMahmedilyasMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    you would do some Regex on it, regular expressions, checking the field of the email address. If Regex returns true then email address is valid so continue, otherwise its false and there is an error so notify the user.



    Regex theEmailValidator = new Regex(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3} \.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)"); //"(?<user>[^@]+)@(?<host>.+)");

    Match emailMatch = theEmailValidator.Match(EmailAddressHere);
    if (!emailMatch.Success)
    {    
        return false;
    }
    else
    {  
       return true;
    }

     

     

    There are a few Regex patterns, this one is what I use and works well

  • Tuesday, October 03, 2006 9:09 PMYasir Imran Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Well, you have any another way, that's probably more neat & visual.

    if you are working with Visual Web Developer, Use Reguler Expression Validation control, drag it next to the email text box, in its properties "ExpressiontoValidate" select "Internet Email Address" & in property "ControltoValidate" select name of the textbox which you use for email input. In its Error property write any message you want to display in case of Wrong email entery, this will work when user will hit "Submit" button on your webform.

  • Wednesday, October 04, 2006 3:24 AMofficexpboy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thx for your reply.

    What i'm looking is -

    Email

    • Syntax
    • domain Validation
    •  mail server and  the recipient Validation

     

  • Saturday, October 31, 2009 8:05 AMOma Danny Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Another good tool to deeply validate email-addresses without sending to recipients is NetXtreme Email Verifier Component .