Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

emailverify.pl

by RyuMaou (Deacon)
on Jan 10, 2007 at 19:23 UTC ( #593988=sourcecode: print w/ replies, xml ) Need Help??

Category: email validation
Author/Contact Info J K Hoffman
ryumaou at sbcglobal dot net
http://www.ryumaou.com/hoffman/netgeek/
Description: A quick and dirty script that checks e-mail addresses in a flat file (one per line) and verifies them at their alleged domain. Not pretty, but it seems to work well enough! In actual practice, I redirect the output to a text file. And, just FYI, I did this to create a whitelist pulled from e-mail addresses out of a power user's address book for an anti-spam upgrade. It wasn't perfect, but it did get the job done.
#!/usr/bin/perl -w

# e-mail verification with CPAN modules
# written, with code from the CPAN example, by J K Hoffman aka RyuMaou
+ on 1-10-07
# (Incidentally, he has a wacky blog at http://www.ryumaou.com/hoffman
+/netgeek/  
#   In case you were interested.)

our $MAILFILE = $ARGV[0];

use strict;
use Mail::CheckUser qw(check_email last_check);

# What time are we going to start this mess?
my $st = localtime;
print "Process started at $st\n";

my $FILE = <>;
# Read the mail file
open(FILE,"$MAILFILE");
my @FILE = <FILE>;
close(FILE);

# Now, down to business...
# Actually check the e-mail addresses
print "Valid e-mail files verified against mail host\n";
foreach $FILE(@FILE) {
    if(check_email($FILE)) {
        print "$FILE";
    }
  } 

# What time did it end?
my $et = localtime;
print "Process ended at $et\n"; 

Comment on emailverify.pl
Download Code

Back to Code Catacombs

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2014-12-18 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (66 votes), past polls