Check Email formatting in c#(code behind).

Aman Sharma

 Here is function to check email is in proper format or not, email is valid or not.


public bool CheckEmail(string Email_Address)


            string pattern = @"^[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]" +




            System.Text.RegularExpressions.Match match = Regex.Match(Email_Address, pattern, RegexOptions.IgnoreCase);



            if (!match.Success)


                return false;






                return true;





We’ll send entered email Id as a parameter to this function & it will return true or false. We can show message as per our requirement if it returns false.

Post a Comment

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !