Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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
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
#   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
my @FILE = <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";

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2021-06-21 07:48 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (98 votes). Check out past polls.