Mail::EXPN - Perl extension for validation of email addresses
use Mail::EXPN qw(isfake); $reason = isfake('bill@microsoft.com'); if ($reason) { print "Bad email: $reason\n"; } elsif (defined($reason)) { print "Email address perfect\n"; } else { print "Could not verify email address: EXPN is turned off at target computer"; } $reason = isfake('bigboss', 'mail.acme.com'); ...
This module checks validity of email addresses. It ensure the existence of a username and domain, unless you specified the MTA, searches the DNS for the MTA (if not specified), and then attempts to use the SMTP keyword EXPN to verify the username. Since EXPN is usually turned off, the module will return undef in such cases, and defined but false if the verification passed. If for any reason the check failed, the module will return a string describing the reason.
Contemporary ISPs never turn EXPN on, to prevent mail abusers harass more efficiently by molesting only existing addresses with junk mail. Therefore, this is not an excellent solution to check the fill-out forms in your site for users supplying false email addresses. Most addresses associated with valid MTAs will return undef.
Mail::EXPN only checks the first mx specified, as it is likely to be the only one to contain the user list.
I tried to rewrite the module using Net::SMTP, but could not figure how to handle the expand and verify methods. They seemed to return an empty reply.
Idea by Raz Information Systems, http://www.raz.co.il.
Ariel Brosh, schop@cpan.org.
Florian Helmberger, florian@cpan.org.
$Id: EXPN.pm,v 1.3 2003/02/01 10:45:49 florian Exp $
perl(1).
To install Mail::EXPN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::EXPN
CPAN shell
perl -MCPAN -e shell install Mail::EXPN
For more information on module installation, please visit the detailed CPAN module installation guide.