.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Debbugs::Mail 3pm" .TH Debbugs::Mail 3pm "2018-02-26" "perl v5.26.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Debbugs::Mail \-\- Outgoing Mail Handling .SH "SYNOPSIS" .IX Header "SYNOPSIS" use Debbugs::Mail qw(send_mail_message get_addresses); .PP my \f(CW@addresses\fR = get_addresses('blah blah blah foo@bar.com') send_mail_message(message => <<\s-1END,\s0 recipients=>[@addresses]); To: \f(CW$addresses\fR[0] Subject: Testing .PP Testing 1 2 3 \&\s-1END\s0 .SH "EXPORT TAGS" .IX Header "EXPORT TAGS" .IP ":all \*(-- all functions that can be exported" 4 .IX Item ":all all functions that can be exported" .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "get_addresses" .IX Subsection "get_addresses" .Vb 2 \& my @addresses = get_addresses(\*(Aqdon@debian.org blars@debian.org \& kamion@debian.org ajt@debian.org\*(Aq); .Ve .PP Given a string containing some e\-mail addresses, parses the string using Mail::Address\->parse and returns a list of the addresses. .SS "default_headers" .IX Subsection "default_headers" .Vb 9 \& my @head = default_headers(queue_file => \*(Aqfoo\*(Aq, \& data => $data, \& msgid => $header{\*(Aqmessage\-id\*(Aq}, \& msgtype => \*(Aqerror\*(Aq, \& headers => [...], \& ); \& create_mime_message(\e@headers, \& ... \& ); .Ve .PP This function is generally called to generate the headers for create_mime_message (and anything else that needs a set of default headers.) .PP In list context, returns an array of headers. In scalar context, returns headers for shoving in a mail message after encoding using encode_headers. .PP \fIoptions\fR .IX Subsection "options" .ie n .IP "queue_file \*(-- the queue file which will generate this set of headers (refered to as $nn in lots of the code)" 4 .el .IP "queue_file \*(-- the queue file which will generate this set of headers (refered to as \f(CW$nn\fR in lots of the code)" 4 .IX Item "queue_file the queue file which will generate this set of headers (refered to as $nn in lots of the code)" .PD 0 .IP "data \*(-- the data of the bug which this message involves; can be undefined if there is no bug involved." 4 .IX Item "data the data of the bug which this message involves; can be undefined if there is no bug involved." .IP "msgid \*(-- the Message-ID: of the message which will generate this set of headers" 4 .IX Item "msgid the Message-ID: of the message which will generate this set of headers" .IP "msgtype \*(-- the type of message that this is." 4 .IX Item "msgtype the type of message that this is." .IP "pr_msg \*(-- the pr message field" 4 .IX Item "pr_msg the pr message field" .IP "headers \*(-- a set of headers which will override the default headers; these headers will be passed through (and may be reordered.) If a particular header is undef, it overrides the default, but isn't passed through." 4 .IX Item "headers a set of headers which will override the default headers; these headers will be passed through (and may be reordered.) If a particular header is undef, it overrides the default, but isn't passed through." .PD .PP \fIdefault headers\fR .IX Subsection "default headers" .IP "X\-Loop \*(-- set to the maintainer e\-mail" 4 .IX Item "X-Loop set to the maintainer e-mail" .PD 0 .IP "From \*(-- set to the maintainer e\-mail" 4 .IX Item "From set to the maintainer e-mail" .IP "To \*(-- set to Unknown recipients" 4 .IX Item "To set to Unknown recipients" .IP "Subject \*(-- set to Unknown subject" 4 .IX Item "Subject set to Unknown subject" .IP "Message-ID \*(-- set appropriately (see code)" 4 .IX Item "Message-ID set appropriately (see code)" .IP "Precedence \*(-- set to bulk" 4 .IX Item "Precedence set to bulk" .IP "References \*(-- set to the full set of message ids that are known (from data and the msgid option)" 4 .IX Item "References set to the full set of message ids that are known (from data and the msgid option)" .IP "In-Reply-To \*(-- set to msg id or the msgid from data" 4 .IX Item "In-Reply-To set to msg id or the msgid from data" .IP "X\-Project-PR-Message \*(-- set to pr_msg with the bug number appended" 4 .IX Item "X-Project-PR-Message set to pr_msg with the bug number appended" .IP "X\-Project-PR-Package \*(-- set to the package of the bug" 4 .IX Item "X-Project-PR-Package set to the package of the bug" .IP "X\-Project-PR-Keywords \*(-- set to the keywords of the bug" 4 .IX Item "X-Project-PR-Keywords set to the keywords of the bug" .IP "X\-Project-PR-Source \*(-- set to the source of the bug" 4 .IX Item "X-Project-PR-Source set to the source of the bug" .PD .SS "send_mail_message" .IX Subsection "send_mail_message" .Vb 4 \& send_mail_message(message => $message, \& recipients => [@recipients], \& envelope_from => \*(Aqdon@debian.org\*(Aq, \& ); .Ve .IP "message \*(-- message to send out" 4 .IX Item "message message to send out" .PD 0 .IP "recipients \*(-- recipients to send the message to. If undefed or an empty arrayref, will use '\-t' to parse the message for recipients." 4 .IX Item "recipients recipients to send the message to. If undefed or an empty arrayref, will use '-t' to parse the message for recipients." .IP "envelope_from \*(-- envelope_from for outgoing messages" 4 .IX Item "envelope_from envelope_from for outgoing messages" .IP "encode_headers \*(-- encode headers using \s-1RFC1522\s0 (default)" 4 .IX Item "encode_headers encode headers using RFC1522 (default)" .IP "parse_for_recipients \*(-- use \-t to parse the message for recipients in addition to those specified. [Can be used to set Bcc recipients, for example.]" 4 .IX Item "parse_for_recipients use -t to parse the message for recipients in addition to those specified. [Can be used to set Bcc recipients, for example.]" .PD .PP Returns true on success, false on failures. All errors are indicated using warn. .SS "encode_headers" .IX Subsection "encode_headers" .Vb 1 \& $message = encode_heeaders($message); .Ve .PP \&\s-1RFC 1522\s0 encodes the headers of a message .SS "rfc822_date" .IX Subsection "rfc822_date" .Vb 1 \& rfc822_date .Ve .PP Return the current date in \s-1RFC822\s0 format in the \s-1UTC\s0 timezone .SS "reply_headers" .IX Subsection "reply_headers" .Vb 1 \& reply_headers(MIME::Parser\->new()\->parse_data(\e$data)); .Ve .PP Generates suggested headers and a body for replies. Primarily useful for use in \s-1RFC2368\s0 mailto: entries. .SH "PRIVATE FUNCTIONS" .IX Header "PRIVATE FUNCTIONS" .SS "_send_message" .IX Subsection "_send_message" .Vb 1 \& _send_message($message,@sendmail_args); .Ve .PP Private function that actually calls sendmail with \f(CW@sendmail_args\fR and sends message \f(CW$message\fR. .PP dies with errors, so calls to this function in send_mail_message should be wrapped in eval.