Scroll to navigation

Sisimai::RFC5322(3pm) User Contributed Perl Documentation Sisimai::RFC5322(3pm)

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 an 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'
    ];

"fillet(String, RegExp)"

"fillet()" returns array reference which include error message lines of given message body and the original message part split by the 2nd argument.

    my $v = 'Error message here
    Content-Type: message/rfc822
    Return-Path: <neko@libsisimai.org>';
    my $r = Sisimai::RFC5322->fillet(\$v, qr|^Content-Type:[ ]message/rfc822|m);
    warn Dumper $r;
    $VAR1 = [
        'Error message here',
        'Return-Path: <neko@libsisimai.org>';
    ];

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2014-2020 azumakuniyuki, All rights reserved.

LICENSE

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

2020-12-26 perl v5.32.0