Validate method
ConfidenceLevel = Validate ( EmailAddress
[, ValidationLevel] )
EmailAddress |
String |
Email address to check |
ValidationLevel |
Short, optional |
Highest level of validation to attempt. Defaults
to hexVeLevelDns |
ConfidenceLevel |
Short |
Highest level of validation acheived without
error, or hexVeLevelBad if the address was conclusively
rejected. |
The Validate method attempts to detect bad email
addresses by checking them at progressively higher levels--essentially
going through each step of the email sending process and stopping just
short of completing the send. You specify the highest level of
validation with the ValidationLevel parameter, which should
be one of the HexValidEmailLevel constants:
- hexVeLevelSyntax
- Validate will only check the syntax of EmailAddress
and, if successful, place the constituent parts of the address in LocalPart,
Domain, and ExtraText.
This does not incur any network traffic and returns immediately.
- hexVeLevelDns
- After successfully checking the syntax, Validate
will look for MX records or an A record for the email address'
domain. The results are placed in MxRecs.
This uses DNS lookups that require network access and may take
several seconds. The timeout for this stage is
Timeouts( hexVeTimeoutDnsTotal
).
- hexVeLevelSmtp
- After successfully checking syntax and getting mail exchange
information, Validate will contact the mail
exchange server and initiate a brief SMTP session to inquire about
the recipient. A transcript of this session, whether successful or
not, is placed in SmtpSession.
This session requires network access, of course, and can take tens
of seconds (many servers are slow). The timeout for this stage
alone is
Timeouts( hexVeTimeoutSmtpTotal )
You can affect the validation behaviors by setting the Options
property.
The return value, ConfidenceLevel, indicates the highest
level Validate completed without some sort of error.
If Error indicates a
conclusive rejection of EmailAddress, ConfidenceLevel
is set to hexVeLevelBad.
|