Validates an email address according to RFCs 5321, 5322 and others.
Check that an email address conforms to RFCs 5321, 5322 and others.
Distinguishes between a Mailbox as defined by RFC 5321 and an addr-spec as defined by RFC 5322. Depending on the context, either can be regarded as a valid email address.
const(Char)[] email
| The email address to check |
CheckDns checkDNS
| If Yes.checkDns then a DNS check for MX records will be made |
EmailStatusCode errorLevel
| Determines the boundary between valid and invalid addresses. Status codes above this number will be returned as-is, status codes below will be returned as EmailStatusCode.valid. Thus the calling program can simply look for EmailStatusCode.valid if it is only interested in whether an address is valid or not. The errorLevel will determine how "picky" isEmail() is about the address. If omitted or passed as EmailStatusCode.none then isEmail() will not perform any finer grained error checking and an address is either considered valid or not. Email status code will either be EmailStatusCode.valid or EmailStatusCode.error. |
EmailStatus
, indicating the status of the email address.Flag for indicating if the isEmail function should perform a DNS check or not.
If set to CheckDns.no
, isEmail does not perform DNS checking.
Otherwise if set to CheckDns.yes
, isEmail performs DNS checking.
Represents the status of an email address
EmailStatusCode statusCode
| The EmailStatusCode to read |
An email status code, indicating if an email address is valid or not. If it is invalid it also indicates why.
Address is valid
Address is valid but a DNS check was not successful
Address is valid for SMTP but has unusual elements
Address is valid within the message but cannot be used unmodified for the envelope
Address contains deprecated elements but may still be valid in restricted contexts
The address is only valid according to the broad definition of RFC 5322. It is otherwise invalid
All finer grained error checking is turned on. Address containing errors or warnings is considered invalid. A specific email status code will be returned indicating the error/warning of the address.
Address is either considered valid or not, no finer grained error checking is performed. Returned email status code will be either Error or Valid.
Address containing warnings is considered valid, that is, any status code below 16 is considered valid.
Address is invalid for any purpose
Address is valid
Could not find an MX record for this domain but an A-record does exist
Could not find an MX record or an A-record for this domain
Address is valid but at a Top Level Domain
Address is valid but the Top Level Domain begins with a number
Address is valid but contains a quoted string
Address is valid but at a literal address not a domain
Address is valid but contains a :: that only elides one zero group
Address contains comments
Address contains Folding White Space
The local part is in a deprecated form
Address contains an obsolete form of Folding White Space
A quoted string contains a deprecated character
A quoted pair contains a deprecated character
Address contains a comment in a position that is deprecated
A comment contains a deprecated character
Address contains a comment or Folding White Space around the @ sign
Address is RFC 5322 compliant but contains domain characters that are not allowed by DNS
Address is too long
The local part of the address is too long
The domain part is too long
The domain part contains an element that is too long
The domain literal is not a valid RFC 5321 address literal
The domain literal is not a valid RFC 5321 address literal and it contains obsolete characters
The IPv6 literal address contains the wrong number of groups
The IPv6 literal address contains too many :: sequences
The IPv6 address contains an illegal group of characters
The IPv6 address has too many groups
IPv6 address starts with a single colon
IPv6 address ends with a single colon
A domain literal contains a character that is not allowed
Address has no local part
Address has no domain part
The address may not contain consecutive dots
Address contains text after a comment or Folding White Space
Address contains text after a quoted string
Extra characters were found after the end of the domain literal
The address contains a character that is not allowed in a quoted pair
Address contains a character that is not allowed
A quoted string contains a character that is not allowed
A comment contains a character that is not allowed
The address cannot end with a backslash
Neither part of the address may begin with a dot
Neither part of the address may end with a dot
A domain or subdomain cannot begin with a hyphen
A domain or subdomain cannot end with a hyphen
Unclosed quoted string
Unclosed comment
Domain literal is missing its closing bracket
Folding White Space contains consecutive CRLF sequences
Folding White Space ends with a CRLF sequence
Address contains a carriage return that is not followed by a line feed
© 1999–2018 The D Language Foundation
Licensed under the Boost License 1.0.
https://dlang.org/phobos/std_net_isemail.html