Validiert eine E-Mail Adresse.
/// <summary>
/// Determines whether the specified email address is in a valid format (RFC 822).
/// </summary>
/// <param name="MailAddress">Email address to validate.</param>
/// <returns><c>True</c> if the email address is formatted correctly, otherwise <c>False</c>.</returns>
/// <remarks></remarks>
public static bool IsMailAddress(String MailAddress)
{
return Regex.IsMatch(MailAddress, @"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");
}
Kommentare zum Snippet