This post discusses the difficult task of validating an email address.
There are two main methods:
1) Do an MX lookup for an email address to find the hostname of the mail server and then connect via SMTP to check the email address.
2) Set an alternate "bounce address" so bounced emails are delivered to a mailbox that is programmatically read and parsed to update your list.
First I’ll discuss #1:
Email Address Validation via MX Lookup and SMTP Server Query
The Chilkat Email component provides a MailMan.MxLookup method to do a DNS query for the MX record given an email address. If multiple servers service the same domain, MxLookup will return the most preferred server. If MxLookup is successful and returns a domain name, you can assume that it is possible to connect to an SMTP server at that address. Your application can call MailMan.VerifyRecipients to validate the "To", "CC", and "BCC" addresses in an email object with the SMTP server.
1) Some ISPs block the outbound SMTP ports (25) so it may not be possible for your program to establish a connection with any SMTP server except your own. In that case, your SMTP server acts as a relay and it has permission to pass through your ISP’s firewall to communicate with other SMTP servers.
2) The VerifyRecipients method begins an SMTP session and issues an "RCPT TO" command for each email address. If the SMTP server indicates that the email address does not exist, then it is known for sure that the email address is invalid. However, there are some cases where the server will not respond with an error even if the email address is invalid: (A) If a catch-all email address is setup for the server, (B) if the server simply doesn’t respond with errors regardless of whether the address is good or bad, or (C) if the server is a secondary server without access to the "database" of valid email addresses.
3) Many SMTP servers require authentication before "RCPT TO" commands can be issued. In other words, you need to have an account on the server and your session must be authenticated before you can send an "RCPT TO" command.
Now for #2 — Setting a Bounce Address (i.e. a Return-Path, or reverse-path).
The Chilkat Email object has a BounceAddress property. When set, it equates to the "Return-Path" or "reverse path" such that bounce replies *should* be sent to this address. A good way of keeping a list clean is to programmatically process bounced email replies and parse for the original recipient’s address. The trouble is that some mail servers send bounce notifications using ad-hoc formats. The Chilkat Bounce component is capable of parsing and extracting the original email address from most automated replies.