SmtpUtf8AddressValidatorTryValidate(MailboxAddress, SmtpUtf8AddressValidationOptions, SmtpUtf8AddressError) Method

Validate a mailbox address as an SMTPUTF8 address.

Definition

Namespace: MimeKit.Utils
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public static bool TryValidate(
	MailboxAddress mailbox,
	SmtpUtf8AddressValidationOptions options,
	out SmtpUtf8AddressError error
)

Parameters

mailbox  MailboxAddress
The mailbox address.
options  SmtpUtf8AddressValidationOptions
The validation options.
error  SmtpUtf8AddressError
The reason that the address is invalid or None if it is valid.

Return Value

Boolean
if the address is valid; otherwise, .

Remarks

Validates the Address of the mailbox as an SMTPUTF8 address as defined by draft-ietf-mailmaint-smtputf8-syntax, using the specified options. The display name and the route of the mailbox are not validated.

  Note

The address is validated exactly as it was parsed or set, so an IDN-encoded domain (such as xn--gr-zia.example.com) is rejected with ALabel unless DecodeIdn is specified, in which case all of the code point, contextual and script rules are applied to the decoded domain.

Exceptions

ArgumentNullException mailbox is .

See Also