I am a danish programmer living in Bangkok.
Read more about me @ rasmus.rummel.dk.
Webmodelling Home > ASP.NET > C# Utility Functions > Email - Validate Address

Validate Email Address

Validating user input often includes validating whether the user have supplied a valid email address - validating email addresses often take the course of regular expressions, however there seems to be no definite solution. I once saw a guy who just tested whether the .Net Framework MailAddress would instantitate with the address and I thought it was great so since then that is what I have been doing (the method of course is not so great if you want to validate client side).


  • Example
    • I use the ValidateAddress function in many projects, eg. in my Discussions WebControl then users supply an email address for their profile.
  • Example Code
    • bool emailAddressIsValid = Utils.Email.ValidateAddress("rasmus@webmodelling.com");

The ValidateAddress function :

public static bool ValidateAddress(string pEmailAddress)
	bool addressIsValid = true;
		MailAddress mailAddress = new MailAddress(pEmailAddress);
		addressIsValid = false;
	return addressIsValid;


You can comment without logging in
 B  U  I  S 
Words: Chars: Chars left: