Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Finding if email addresses exist?

by biosysadmin (Deacon)
on Jun 21, 2005 at 00:20 UTC ( [id://468525]=note: print w/replies, xml ) Need Help??


in reply to Finding if email addresses exist?

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.

Replies are listed 'Best First'.
Re^2: Finding if email addresses exist?
by merlyn (Sage) on Jun 21, 2005 at 01:11 UTC
    And the FAQ also says that's unreliable. There are servers that say "sure, go ahead" for every address tested that way. And there are servers that say "no, we won't tell you, try sending first" for every email tested that way.

    Hence, you'll get both false positives and false negatives for such an approach, and far greater than your true reality hits.

    Hence, the FAQ's wisdom should be followed: you can't get there from here.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re^2: Finding if email addresses exist?
by devnul (Monk) on Jun 21, 2005 at 01:51 UTC
    This is important enough, I feel compelled to re-iterate what Merlyn just said.

    Please do not validate email addresses by looking for mail server replies like this. The only thing you can rely upon by doing this is that what you are getting back is 100% unreliable.

    - dEvNuL
Re^2: Finding if email addresses exist?
by mikeraz (Friar) on Jun 21, 2005 at 03:25 UTC

    Among the other reasons to not use this approach mentioned already is . . . Some spam fighting systems, mine included, monitor the maillog and quickly throw up a firewall rule blocking access to the system as soon as delivery is attempted to an invalid address. The object is to block dictionary attacks. The benefit is that your system no longer processes email destined for bogus addresses. There's a side effect of the sender being cut off after the first invalid address so any spam addressed to multiple adressees will never get delivered to legit addressees either.

    Be Appropriate && Follow Your Curiosity
      ...but a horrid problem for the lex-dysic... whose wife has personal and business accounts: fi_lname@work... and lname_fi@personal...

      So if I botch an address with lname_fi@work..., her server there is gonna, forever afterward, bounce (or worse, simply dev\nul it) until she cleans my IP out of the filter?

      Agreed (I'D YELL AGREEMENT! but that would be impolite... but isn't that solution rather draconian (or, alternately, is there something here I don't understand)?

        Dyslexia? That's what address books are for. As it is I lock 'em out for six minutes. A spammer goes on. A legit email will eventually bounce and then can send again.

        Draconian? My tiny little home system went from processing over 30,000 incoming emails a day to ~4,800.

        Be Appropriate && Follow Your Curiosity

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://468525]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-29 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found