ValidateAddress (Dundas Mailer Control 1.0)

Dundas

ValidateAddress (Dundas Mailer Control 1.0)

Overview | Properties | Methods

Call this method to validate an email address.

Syntax

[long] = MailerObject.ValidateAddress(Address as string)

The ValidateAddress method syntax has the following parts:

Part

Description

Address

A string expression specifying the address to be validated.

long

The return value of the method call signifying the validity of the supplied address.

  Return Values

This function will return zero (0) if the supplied email address is valid. A non-zero return value indicates an invalid address. The following is a listing of return values and their meanings:

  • One (1): The specified address was empty.

  • Two (2): The specified address was too large.

  • Three (3): The SMTP send operation failed.

  • Four (4): The specified user was not found.

  • Five (5): The MX record was not found.

  • Six (6): The address validation operation failed.

NOTE: unlike the other Mailer control methods ValidateAddress WILL NOT raise an exception if an error occurs.

Remarks

IMPORTANT: If you do not specify a DNS server before calling this method then it will take a substantial amount of time to perform the validation. Make sure you use a DNS server!

ValidateAddress uses the DNSServers collections to perform mail exchange lookups, so it is highly recommended that you add multiple DNS servers to this collection. If no DNS servers have been added to the DNSServers collection then the following default servers will be tried in their respective order: "A.ROOT-SERVERS.NET", "B.ROOT-SERVERS.NET" and "C.ROOT-SERVERS.NET". If these servers are not available then the method call will fail and return an error code.

To validate an address this method first determines if the specified domain name exists (remember that an email address consists of username@domainname) by performing a DNS lookup of mail exchange records. If the domain name exists we then initiate sending a message to the specified username for the domain whose existence was just verified. If the server for the specified domain name then refuses to accept any data for the username ValidateAddress returns FALSE, indicating that the address does not exist. However, if the server requests data we assume that the specified username exists and the function call returns TRUE.

NOTE: In certain instances the ValidateAddress method may return erroneous information concerning the existence of an email address. This may occur as a result of:

  • The mail server being down temporarily.

  • The SMTP protocol implementation of the server.

You can increase the efficiency and speed of ValidateAddress by adding DNS servers to the DNSServers collection.

See Also: DNSServers Collection