Sisimai::RFC1894(3pm)

πŸ’– Sisimai::RFC1894(3pm) β€” the DSN field bestie πŸ’–

User Contributed Perl Documentation ✨ Sisimai::RFC1894(3pm)

okay so real quick, this is a man page for a Perl module, and it's literally the cutest little RFC-wrangler you've ever met. buckle up πŸŽ€


🌸 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 (user unknown)');
print Data::Dumper::Dumper $v;  # ['reporting-mta', 'dns', 'mx.nyaan.org', 'host', ''];
print Data::Dumper::Dumper $r;  # ['status', '', '5.1.1', 'stat', 'user unknown'];

three whole lines of setup and you're already parsing DSN fields, we love a low-effort icon πŸ’…


🌈 DESCRIPTION 🌈

Sisimai::RFC1894 is out here providing methods for checking or getting DSN fields, and honestly? it ate. πŸ”₯


πŸ‘‘ CLASS METHODS πŸ‘‘

"match(String)" 🎯

match() method checks the argument includes the field defined in RFC3464 or not β€” and it answers in numbers, no cap.

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

so like, 0 means nope, that's just a normal header, 1 means yeah that's a DSN field, 2 means it's a DSN field that also matched a recipient-ish pattern. the vibes are immaculate 🌸


"label(String)" 🏷️

label() method returns a lower cased field name such as "diagnostic-code" from the given email header or the delivery status field. it's giving "I just want the name, please and thank you" πŸ’–

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
🫢 okay bestie yes, the last three lines literally say field, not label β€” we're keeping it exactly how the page wrote it, character for character, because that's the rule and I don't make the rules (I just enforce them aggressively). πŸ’€ the last one gives you undef when you hand it an empty string, which is valid and iconic.

"field(String)" 🧚

field() method returns the splited values as an array reference from the given string including DSN fields defined in RFC3464. yes, "splited" β€” that's the original wording, we preserve ✨

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

the returned array is the whole squad: label, the type thing, the value, a short code, and sometimes a comment chilling at the end πŸ’œ


πŸ¦‹ AUTHOR πŸ¦‹

azumakuniyuki β€” absolute legend, main character energy πŸ‘‘


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


πŸ’œ LICENSE πŸ’œ

This software is distributed under The BSD 2-Clause License. slay, permissive, we love her 🌈


and that's the whole page bestie, no notes πŸ’… this beauty is perl v5.40.1, dated 2026-07-05, and yeah β€” Sisimai::RFC1894(3pm) fr fr. mwah, go parse some DSN fields 🫢✨

πŸ“¦ where this page comes from