Click here to Skip to main content
15,355,050 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Can Any Tell me Through example How to validate an email id

1 solution

You can do it using Regular expressions.

using System.Text; 

private bool IsValidEmail(string email)        
    string emailRegEx = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|"
                      + @"0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*([-][a-z|0-9]+)*\.([a-z]" 
                      + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
    RegularExpressions.Match match = 
    RegularExpressions.Regex.Match(email, emailRegEx, RegularExpressions.RegexOptions.IgnoreCase);            
    return match.Success;  

Read this for more info:
MSDN: How To: Use Regular Expressions to Constrain Input in ASP.NET[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900