NAME
Mail::CheckUser - checking email addresses for validness
SYNOPSIS
use Mail::CheckUser qw(check_email);
my $res = check_email($email_addr);
use Mail::CheckUser;
my $res = Mail::CheckUser::check_email($email_addr);
DESCRIPTION
This Perl module provides routines for checking validness of email address.
It makes several checks:
it checks syntax of email address;
it checks if there any MX record for specified in email domain or if there exist such host;
it tries to connect to email server directly via SMTP to check with command VRFY if user is valid.
If is possible to turn of all networking checks (second and third checks). See "GLOBAL VARIABLES".
This module was designed with CGIs (or any other dynamic Web content programmed with Perl) in mind. Usually it is required to check fastly e-mail address in form. If check can't be finished in reasonable time e-mail address should be treated as valid. This is default policy. By default if timeout happens result of check is treated as positive (it can be overridden - see "GLOBAL VARIABLES").
EXAMPLE
This simple script checks if email address blabla@foo.bar is valid.
use Mail::CheckUser qw(check_email);
my $email = "blabla@foo.bar";
if(check_email($email)) {
print "E-mail address <$email> is OK\n";
} else {
print "E-mail address <$email> isn't valid\n";
}
GLOBAL VARIABLES
Using global variables listed below it is possible to configure check_email().
$Mail::CheckUser::Skip_Network_Checks - if it is true then do only syntax checks. By default it is false.
$Mail::CheckUser::Skip_SMTP_Checks - if it is true then do not try to connect to mail server to check if user exist on it. By default it is false.
$Mail::CheckUser::Timeout - timeout in seconds for network checks. By default it is 60.
$Mail::CheckUser::Treat_Timeout_As_Fail - if it is true Mail::CheckUser treats timeouted checks as failed checks. By default it is false.
$Mail::CheckUser::Debug - if it is true then enable debug output on STDERR. By default it is false.
AUTHOR
Ilya Martynov m_ilya@agava.com
SEE ALSO
perl(1).