Hello,
I have a question. How can i determine if an email address is in the correct format. I use the System.Net.Mail.MailMessage to send my messages. I am getting my To email addresses from the database but when the address is not in the correct email format the program stops sending. How can i determine if its in correct format and if it is not then jump to the next.? Thanks.
public static bool IsValidEmailAddress(string sEmail)
{
if (sEmail == null)
return false;
else
return Regex.IsMatch(sEmail, @"
^[-a-zA-Z0-9][-.a-zA-Z0-9]*@[-.a-zA-Z0-9]+(\.[-.a-zA-Z0-9]+)*\.(com|edu|info|gov|int|mil|net|org|biz|name|museum|coop|aero|pro|[a-zA-Z]{2})$",RegexOptions.IgnorePatternWhitespace);
}