Edit: I stand corrected. Don't do this, see explanation below. Thanks to all of the wise and cordial monks who have shown me the light on this topic, I could have very easily been flamed for making an unwise suggestion. :)
As jeyroz said, Email::Valid is a good tool for a quick and dirty check. However, there's one more thing that you can do.
Here's a quick snippet from a conversation with an e-mail server:
[tex@smtp-client ~]$ telnet smtp-server.example.com 25
Trying xxx.xx.xxx.x...
Connected to smtp-server.example.com
Escape character is '^]'.
MAIL FROM: <user@smtp-client.example.com>
250 Ok
RCPT TO: <valid-user@smtp-server.example.com>
250 Ok
So, at this point you can break the connection knowing you have a valid user. Here's the same conversation, slightly modified:
[tex@smtp-client ~]$ telnet smtp-server.example.com 25
Trying xxx.xx.xxx.x...
Connected to smtp-server.example.com
Escape character is '^]'.
MAIL FROM: <user@smtp-client.example.com>
250 Ok
RCPT TO: <invalid@bioinformatics.rit.edu>
450 <invalid@bioinformatics.rit.edu>: Recipient address rejected: User
+ unknown in local recipient table
So, if you write a program that speaks SMTP well, you can check a mail server for valid users without actually sending an e-mail. There's no guarantee that the server won't bounce the message after accepting it, but this just shows another trick beyond just using Email::Valid. |