NAME

Sisimai::RFC1894 - DSN field defined in RFC3464 (obsoletes RFC1894)

SYNOPSIS

use Sisimai::RFC1894;

print Sisimai::RFC1894->match('From: Nyaan <kijitora@libsisimai.org>'); # 0
print Sisimai::RFC1894->match('Reporting-MTA: DNS; mx.libsisimai.org'); # 1
print Sisimai::RFC1894->match('Final-Recipient: RFC822; cat@nyaan.jp'); # 2

my $v = Sisimai::RFC1894->field('Reporting-MTA: DNS; mx.nyaan.jp');
my $r = Sisimai::RFC1894->field('Status: 5.1.1');
print Data::Dumper::Dumper $v;  # ['reporting-mta', 'dns', 'mx.nyaan.org', 'host'];
print Data::Dumper::Dumper $r;  # ['status', '', '5.1.1', 'stat'];

DESCRIPTION

Sisimai::RFC1894 provide methods for checking or getting DSN fields

CLASS METHODS

match(String)

match() method checks the argument includes the field defined in RFC3464 or not

print Sisimai::RFC1894->match('From: Nyaan <kijitora@libsisimai.org>'); # 0
print Sisimai::RFC1894->match('Reporting-MTA: DNS; mx.libsisimai.org'); # 1
print Sisimai::RFC1894->match('Final-Recipient: RFC822; cat@nyaan.jp'); # 2

label(String)

label() method returns a lower cased field name such as "diagnostic-code" from the given email header or the delivery status field.

print Sisimai::RFC1894->label('Remote-MTA: DNS; mx.nyaan.jp');  # remote-mta
print Sisimai::RFC1894->field('Status: 5.1.1');                 # status
print Sisimai::RFC1894->field('Subject: Nyaan');                # subject
print Sisimai::RFC1894->field('');                              # undef

field(String)

field() method returns the splited values as an array reference from the given string including DSN fields defined in RFC3464.

my $v = Sisimai::RFC1894->field('Remote-MTA: DNS; mx.nyaan.jp');
my $r = Sisimai::RFC1894->field('Status: 5.1.1');
print Data::Dumper::Dumper $v;  # ['remote-mta', 'dns', 'mx.nyaan.org', 'host'];
print Data::Dumper::Dumper $r;  # ['status', '', '5.1.1', 'stat'];

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2018-2024 azumakuniyuki, All rights reserved.

LICENSE

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