Debbugs::Mail(3pm)
π Debbugs::Mail β outgoing mail handling, bestie edition β¨
okay so this is Debbugs::Mail, a lil Perl module from the User Contributed Perl Documentation collection, and it is literally the part of Debbugs that deals with mail going out the door. Sending it, encoding it, header-ing it up π
πΈ NAME πΈ
Debbugs::Mail β Outgoing Mail Handling. that's it, that's the vibe π«Ά
β¨ SYNOPSIS β¨
use Debbugs::Mail qw(send_mail_message get_addresses);
my @addresses = get_addresses('blah blah blah foo@bar.com')
send_mail_message(message => <<END, recipients=>[@addresses]); To:
$addresses[0] Subject: Testing
Testing 1 2 3 END
ngl bestie, that synopsis is giving "written at 3am" energy π but it's the real one, so we're keeping it exactly as-is. no notes.
π EXPORT TAGS π
:allβ every function that can be exported. the whole friend group, no one left behind π
π₯ FUNCTIONS π₯
π get_addresses π
my @addresses = get_addresses('don@debian.org blars@debian.org
kamion@debian.org ajt@debian.org');
you hand it a string with some e-mail addresses in it, it parses that string with Mail::Address->parse, and hands you back a list of the addresses. that's the whole job. iconic, lowkey π¦
π default_headers π
my @head = default_headers(queue_file => 'foo',
data => $data,
msgid => $header{'message-id'},
msgtype => 'error',
headers => [...],
);
create_mime_message(\@headers,
...
);
so this one is generally called to generate the headers for create_mime_message β and honestly for anything else that needs a set of default headers. it's the header factory fr fr πβ¨
the context thing, pay attention bestie: in list context it returns an array of headers. in scalar context it returns headers you can shove into a mail message after encoding them with encode_headers.
π options π
queue_fileβ the queue file that's gonna generate this set of headers. it's called$nnall over the codebase, iykyk.dataβ the data of the bug this message involves. can be undefined if there's no bug involved at all. no bug, no problem πmsgidβ theMessage-ID:of the message that's gonna generate this set of headers.msgtypeβ what type of message this is.pr_msgβ the pr message field.headersβ a set of headers that will override the default headers. these get passed through, and they may get reordered (yes, reordered, don't panic). if a particular header isundef, it overrides the default but does not get passed through. sneaky but true.
π default headers π
X-Loopβ set to the maintainer e-mail.Fromβ set to the maintainer e-mail.Toβ set toUnknown recipients.Subjectβ set toUnknown subject.Message-IDβ set appropriately (go read the code, bestie, it's a whole situation).Precedenceβ set tobulk.Referencesβ set to the full set of message ids that are known, fromdataand themsgidoption.In-Reply-Toβ set to the msg id, or to the msgid fromdata.X-Project-PR-Messageβ set topr_msgwith the bug number appended.X-Project-PR-Packageβ set to the package of the bug.X-Project-PR-Keywordsβ set to the keywords of the bug.X-Project-PR-Sourceβ set to the source of the bug.
π send_mail_message π
send_mail_message(message => $message,
recipients => [@recipients],
envelope_from => 'don@debian.org',
);
messageβ the message you wanna send out. go off πrecipientsβ who you're sending it to. if it'sundefor an empty arrayref, it'll use-tto parse the message for recipients instead.envelope_fromβ the envelope_from for outgoing messages.encode_headersβ encode headers using RFC1522 (this is the default, btw β¨).parse_for_recipientsβ use-tto parse the message for recipients in addition to the ones you specified. this is how you'd sneak in Bcc recipients, for example π
returns true on success, false on failure. every error is reported using warn. so like, it'll tell you, just not that loudly.
π encode_headers π
$message = encode_heeaders($message);
RFC 1522 encodes the headers of a message. yep, the code block above really does say encode_heeaders β typo's in the original, we're keeping it exactly, character for character π (the function itself is encode_headers, no chaos there).
π rfc822_date π
rfc822_date
returns the current date in RFC822 format, in the UTC timezone. no local-time shenanigans, periodt π
π reply_headers π
reply_headers(MIME::Parser->new()->parse_data(\$data));
generates suggested headers and a body for replies. primarily useful for use in RFC2368 mailto: entries. very "reply guy but make it a function" energy π
π§ PRIVATE FUNCTIONS π§
π _send_message π
_send_message($message,@sendmail_args);
private function that actually calls sendmail with @sendmail_args and sends the message $message. it's the one doing the real work while everyone else takes credit, main character energy fr.
β οΈ bestie, listen: this one dies on errors. so any call to it insidesend_mail_messageneeds to be wrapped ineval. noeval, no safety net. wrap it. π«Ά
π that's the whole page π
this lil slice of the docs is from perl v5.40.1, dated 2026-04-27, and it's Debbugs::Mail(3pm) from Perl's own User Contributed Perl Documentation. slay, go send some mail responsibly, and remember: eval around _send_message. always. periodt. π
β¨
π¦ where this page comes from
- ubuntu stonking: libdebbugs-perl 2.6.5
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms