Re: Finding out if an email is inactive
by adrianh (Chancellor) on Aug 06, 2004 at 18:58 UTC
|
But what code do I use to query if their email is still active?
The short answer, and indeed the long one, is that you can't. Not for sure.
Mail::CheckUser with all the networked checks enabled will probably be the best you can get.
| [reply] |
Re: Finding out if an email is inactive
by Corion (Patriarch) on Aug 06, 2004 at 19:00 UTC
|
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.
| [reply] |
|
|
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";
}
| [reply] [d/l] |
|
|
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.
| [reply] |
Re: Finding out if an email is inactive
by sweetblood (Prior) on Aug 06, 2004 at 18:58 UTC
|
Sadly no amount of Perl training or any other training will tell you if an email address is active short of asking the owner of that address.
The good news is as long as your not a spammer, your recipients should be happy to tell you that their email address is good
Sorry!
| [reply] |
Re: Finding out if an email is inactive
by amw1 (Friar) on Aug 06, 2004 at 18:55 UTC
|
afaik there is no way to do it (thank god) short of sending mail to all of the addresses and waiting for bounces.
| [reply] |
Re: Finding out if an email is inactive
by xorl (Deacon) on Aug 06, 2004 at 21:24 UTC
|
You could send each mail server a VRFY command, but most mail admins turn that command off since spammers use it to harvest addresses.
I'd just send an email to each address saying "We're just check to make sure your address is correct. If you'd like to update your information or be removed from our list contact us" Obviously if you get any bounces they're an inactive address.
There should be plenty of places to find a perl mass email acript. =(
| [reply] |
|
|
Thanks for everyone's help. I'll go the mass email / verify route. I appreciate the shared wisdom.
Jared
| [reply] |