NAME

Sisimai::RFC5322 - Email address related utilities

SYNOPSIS

use Sisimai::RFC5322;

print Sisimai::RFC5322->is_emailaddress('neko@example.jp');    # 1
print Sisimai::RFC5322->is_domainpart('example.jp');           # 1
print Sisimai::RFC5322->is_mailerdaemon('neko@example.jp');    # 0

DESCRIPTION

Sisimai::RFC5322 provide methods for checking email address.

CLASS METHODS

is_emailaddress( email address )

is_emailaddress() checks the argument is valid email address or not.

print Sisimai::RFC5322->is_emailaddress( 'neko@example.jp' );  # 1
print Sisimai::RFC5322->is_emailaddress( 'neko%example.jp' );  # 0

my $addr_with_name = [ 
    'Stray cat <neko@example.jp',
    '=?UTF-8?B?55m954yr?= <shironeko@example.co.jp>',
];
for my $e ( @$addr_with_name ) {
    print Sisimai::RFC5322->is_emailaddress( $e ); # 1
}

is_domainpart( Domain )

is_domainpart() checks the argument is valid domain part of a email address or not.

print Sisimai::RFC5322->is_domainpart( 'neko@example.jp' );  # 0
print Sisimai::RFC5322->is_domainpart( 'neko.example.jp' );  # 1

is_domainpart( Domain )

is_mailerdaemon() checks the argument is mailer-daemon or not.

print Sisimai::RFC5322->is_mailerdaemon( 'neko@example.jp' );          # 0
print Sisimai::RFC5322->is_mailerdaemon( 'mailer-daemon@example.jp' ); # 1

received( String )

received() returns array reference which include host names in the Received header.

my $v = 'from mx.example.org (c1.example.net [192.0.2.1]) by mx.example.jp';
my $r = Sisimai::RFC5322->received( $v );

warn Dumper $r; 
$VAR1 = [
    'mx.example.org',
    'mx.example.jp'
];

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2014-2015 azumakuniyuki <perl.org@azumakuniyuki.org>, All Rights Reserved.

LICENSE

This software is distributed under The BSD 2-Clause License.