The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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:

  1. it checks syntax of email address;

  2. it checks if there any MX record for specified in email domain or if there exist such host;

  3. 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".

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 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 false.

  • $Mail::CheckUser::Timeout - timeout in seconds for network checks. By default 60.

  • $Mail::CheckUser::Debug - if it is true then enable debug output on STDERR. By default false.

AUTHOR

Ilya Martynov m_ilya@agava.com

SEE ALSO

perl(1).