C# Class EmailValidation.EmailValidator

An Email validator.
An Email validator.
显示文件 Open project: jstedfast/EmailValidation Class Usage Examples

Public Methods

Method Description
Validate ( string email, bool allowTopLevelDomains = false, bool allowInternational = false ) : bool

Validate the specified email address.

Validates the syntax of an email address.

If allowTopLevelDomains is true, then the validator will allow addresses with top-level domains like postmaster@dk.

If allowInternational is true, then the validator will use the newer International Email standards for validating the email address.

Private Methods

Method Description
IsAtom ( char c, bool allowInternational ) : bool
IsDomain ( char c, bool allowInternational ) : bool
IsHexDigit ( char c ) : bool
IsLetterOrDigit ( char c ) : bool
SkipAtom ( string text, int &index, bool allowInternational ) : bool
SkipDomain ( string text, int &index, bool allowTopLevelDomains, bool allowInternational ) : bool
SkipIPv4Literal ( string text, int &index ) : bool
SkipIPv6Literal ( string text, int &index ) : bool
SkipQuoted ( string text, int &index, bool allowInternational ) : bool
SkipSubDomain ( string text, int &index, bool allowInternational ) : bool
SkipWord ( string text, int &index, bool allowInternational ) : bool

Method Details

Validate() public static method

Validate the specified email address.

Validates the syntax of an email address.

If allowTopLevelDomains is true, then the validator will allow addresses with top-level domains like postmaster@dk.

If allowInternational is true, then the validator will use the newer International Email standards for validating the email address.

/// is null. ///
public static Validate ( string email, bool allowTopLevelDomains = false, bool allowInternational = false ) : bool
email string An email address.
allowTopLevelDomains bool true if the validator should allow addresses at top-level domains; otherwise, false.
allowInternational bool true if the validator should allow international characters; otherwise, false.
return bool