NAME

Email::IsEmail - Checks an email address against the following RFCs: 3696, 1123, 4291, 5321, 5322

VERSION

Version 3.04.8

SYNOPSIS

Checks an email address against the following RFCs: 3696, 1123, 4291, 5321, 5322

Example usage:

use Email::IsEmail qw/IsEmail/;

my $valid = Email::IsEmail('test@example.org');
...
my $checkDNS    = 0;   # do not check DNS (default)
my $error_level = -1;  # use dafault error threshold: Email::IsEmail::THRESHOLD
my %parse_data  = ();  # collect E-mail components

$valid = IsEmail( 'test@[127.0.0.1]', $checkDNS, $error_level, \%parse_data );

print "Local-part: ",     $parse_data{Email::IsEmail::COMPONENT_LOCALPART}, "\n";
print "Domain: ",         $parse_data{Email::IsEmail::COMPONENT_DOMAIN}, "\n";
# only for IPv4/IPv6 addresses:
print "Domain literal: ", $parse_data{Email::IsEmail::COMPONENT_LITERAL}, "\n";

FUNCTIONS

IsEmail
my $valid = Email::IsEmail( $email, $checkDNS, $errorlevel, $parsedata );

Check that an email address conforms to RFCs 5321, 5322 and others

As of Version 3.0, we are now distinguishing clearly between a Mailbox as defined by RFC 5321 and an addr-spec as defined by RFC 5322. Depending on the context, either can be regarded as a valid email address. The RFC 5321 Mailbox specification is more restrictive (comments, white space and obsolete forms are not allowed)

@param string   $email          The email address to check
@param boolean  $checkDNS       If true then a DNS check for MX records will be made
@param int      $errorlevel     Determines the boundary between valid and invalid addresses.
                                Status codes above this number will be returned as-is,
                                status codes below will be returned as Email::IsEmail::VALID. Thus the
                                calling program can simply look for Email::IsEmail::VALID if it is
                                only interested in whether an address is valid or not. The
                                errorlevel will determine how "picky" Email::IsEmail() is about
                                the address.

                                If omitted or passed as -1 then Email::IsEmail() will return
                                true or false rather than an integer error or warning.

                                NB Note the difference between $errorlevel = -1 and
                                $errorlevel = 0
@param hashref  $parsedata      If passed, returns the parsed address components

AUTHOR

Original PHP version Dominic Sayers <dominic@sayers.cc>

Perl port Leandr Khaliullov, <leandr at cpan.org>

COPYRIGHT

Copyright © 2008-2011, Dominic Sayers.

Copyright 2016 Leandr Khaliullov.

All rights reserved.

BUGS

Please report any bugs or feature requests to bug-email-isemail at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Email-IsEmail. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Email::IsEmail

You can also look for information at:

ACKNOWLEDGEMENTS

- Dominic Sayers (original PHP version of is_email)
- Daniel Marschall (test schemas)
- Umberto Salsi (PHPLint)

LICENSE

This program is released under the following license: BSD

See http://www.opensource.org/licenses/bsd-license.php

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice,
  this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.
- Neither the name of Dominic Sayers nor the names of its contributors may be
  used to endorse or promote products derived from this software without
  specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.