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() checks the argument includes a 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() returns a lower cased field name such as "diagnostic-code" from given an email header or a 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() returns splited values as an array reference from given a 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-2023 azumakuniyuki, All rights reserved.

LICENSE

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