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"; }
In reply to Re^2: Finding out if an email is inactive
by JaredHess
in thread Finding out if an email is inactive
by JaredHess
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |