| 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"; |
|
|
|---|