Yes, you can do it the same way that an MTA determines whether a remote recipient is valid, through an SMTP dialog with his MTA.
I wrote a Perl script that can be used to validate a list of recipients. Here is how it works (using
rfs9999@earthlink.net for valid and
not_anybody@aol.com as invalid recipients).
1. Look up the recipient's domain in DNS to find the MX hosts which serve that domain.
2. Make a connection on port 25 to one of the MX hosts for the domain
3. Start an SMTP dialog with the key piece being RCPT TO:<recip> and reading the response from the server.
4. The MTA will respond by saying the recipient is OK or giving a reason why it won't accept a message for him. The recipient may be invalid, his mailbox may be full, etc. Any number of reasons.
5. Close the connection and write the results. For example:
rfs9999@earthlink.net: valid recipient address
not_anybody@aol.com: 550 5.1.1 <not_anybody@aol.com>: Recipient address rejected: aol.com
If you want a copy of the script send me an e-mail.
-Rick