in reply to Finding out if an email is inactive

What do you mean by if their email is still active ? What is the difference between an inactive and an active email address?

Is it that the server accepts the email address? Is it that the email gets delivered to a mailbox? Is it that a person reads the email? Is it that a person wants the email?

Ask yourself and ask your boss about that.

Short of sending out an email and getting a confirmation email, there is no way to determine that a person still sits behind the email address you got and wants to receive your emails. Consider offering discount tickets via your email, or some raffle or whatever to make people (re)subscribe.

Also note that many spam filters directly delete emails that contain links to images outside the email, so you will be throwing out the child with the bathwater if you try that route.

  • Comment on Re: Finding out if an email is inactive

Replies are listed 'Best First'.
Re^2: Finding out if an email is inactive
by JaredHess (Acolyte) on Aug 06, 2004 at 21:03 UTC

    Bummer...

    By "inactive" I mean if it never gets to an inbox because that email account no longer exists at that organization.

    Sadly (I guess), it doesn't sound like this is something that's possible. However, when I was tinkering (which is about all I can really do with Perl) I came up with a script that checks for invalid / valid email accounts by trying to send a dummy email. Although I'm not sure if it's doing what I hope it's doing.

    In the code below I have three email addresses from our organization domain name. The first in the array is a valid email (mine). The second and third are invalid. Seems to pull out the invalid ones like it should, and no actual email gets sent *shrugs*. Can anyone tell me what this is really doing?

    #!/usr/local/bin/perl use CGI qw(:all); use Net::SMTP; # Checks email to see if it's active print header; gatheremails(); results(); ## GATHERS EMAILS sub gatheremails { # The first element of the array is my valid email, the others are dum +mies. @emails = ('jhess@wilcoxassoc.com','jhess1@wilcoxassoc.com','jhess +2@wilcoxassoc.com'); foreach $email(@emails){ checkit(); } } ## CHECK THE EMAIL BY DOING A MAILSEND ## WITHOUT REALLY SENDING ANYTHING sub checkit{ ## SMTP BEGIN $smtp = Net::SMTP->new('mail.wilcoxassoc.com'); # connect to an SM +TP server $smtp->mail('webmaster@wilcoxassoc.com'); # use the sender's a +ddress here $smtp->to($email) || addinvalid($email); # recipient's addre +ss # $smtp->data(); # Start the mail $smtp->quit; # Close the SMTP connection # If the flag shows it's not a bad email # then put in $email into the @valid array. if ($emailisbad ne "1"){ # GROWS AN ARRAY OF VALID EMAILS push(@valid,$email); } # Reset the flag to 0 for next email $emailisbad = "0"; } # PRINTS THE RESULTS TO THE BROWSER sub results{ print "<center><h2>Check for Active Emails</h2></center>"; print "<p>Active Email Addresses:"; print "<br>----------------------<br>"; if (@valid){ foreach $valid(@valid){ print "<li>$valid</li>"; } } print "<p>Inactive Email Addresses:"; print "<br>----------------------<br>"; if (@invalid){ foreach $invalid(@invalid){ print "<li>$invalid</li>"; } } } # GROWS AN ARRAY OF EMAILS THAT ARE INVALID sub addinvalid{ my ($errmsg) = @_; push(@invalid,$email); $emailisbad = "1"; }

      That will work for some mail servers. Others will accept all mail, and later generate a bounce for it. qmail behaves this way, for example. If you tried using this, VRFY, EXPN, and also checking that the domain still exists, you might be able to trim some users from your list, but not all. It's probably easier to just send the mail and watch for bounces.

      For bounces, BTW, you should consider using something like VERPs. The general idea is you set up a catchall mailbox for bouncetest-*, then send out each message with a unique sender that starts with bouncetest-. qmail's VERP implementation encodes the recipient email address into the bounce address, although you can put anything you want there. Then when you get a bounce, you know what message you sent caused it. It can be surprisingly hard to figure this out otherwise, either programatically or by hand.