SmtpAddressValidator Class

A validator for (non-internationalized) SMTP email addresses.

Definition

Namespace: MimeKit.Utils
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public static class SmtpAddressValidator
Inheritance
Object    SmtpAddressValidator

Remarks

Validates email addresses that will be used in the MAIL FROM and RCPT TO commands of an SMTP transaction that does not use the SMTPUTF8 extension.

An address is valid if and only if it matches the Mailbox syntax defined in rfc5321, which only permits ASCII characters. An internationalized domain must therefore be expressed using A-labels (such as user@xn--gr-zia.example.com), which are permitted. An address that would be valid if it were not for its non-ASCII characters is rejected with NonAscii, which indicates that the address requires the SMTPUTF8 extension. Such addresses can be validated using the SmtpUtf8AddressValidator.

The length limits defined in rfc5321 are only enforced when EnforceLengthLimits is specified.

Methods

IsValid(MailboxAddress) Check whether a mailbox address is a valid SMTP address.
IsValid(String) Check whether an address is a valid SMTP address.
IsValid(MailboxAddress, SmtpAddressValidationOptions) Check whether a mailbox address is a valid SMTP address.
IsValid(String, SmtpAddressValidationOptions) Check whether an address is a valid SMTP address.
TryValidate(MailboxAddress, SmtpAddressError) Validate a mailbox address as an SMTP address.
TryValidate(String, SmtpAddressError) Validate an address as an SMTP address.
TryValidate(MailboxAddress, SmtpAddressValidationOptions, SmtpAddressError) Validate a mailbox address as an SMTP address.
TryValidate(String, SmtpAddressValidationOptions, SmtpAddressError) Validate an address as an SMTP address.

See Also