<<
Debbugs::Mail -- Outgoing Mail Handling
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
- :all -- all functions that can be exported
my @addresses = get_addresses('don@debian.org blars@debian.org
kamion@debian.org ajt@debian.org');
Given a string containing some e-mail addresses, parses the string using Mail::Address->parse and returns a list of the addresses.
my @head = default_headers(queue_file => 'foo',
data => $data,
msgid => $header{'message-id'},
msgtype => 'error',
headers => [...],
);
create_mime_message(\@headers,
...
);
This function is generally called to generate the headers for create_mime_message (and anything else that needs a set of default headers.)
In list context, returns an array of headers. In scalar context, returns headers for shoving in a mail message after encoding using encode_headers.
- queue_file -- the queue file which will generate this set of headers (refered to as $nn in lots of the code)
-
- data -- the data of the bug which this message involves; can be undefined if there is no bug involved.
-
- msgid -- the Message-ID: of the message which will generate this set of headers
-
- msgtype -- the type of message that this is.
-
- pr_msg -- the pr message field
-
- 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.
- X-Loop -- set to the maintainer e-mail
-
- From -- set to the maintainer e-mail
-
- To -- set to Unknown recipients
-
- Subject -- set to Unknown subject
-
- Message-ID -- set appropriately (see code)
-
- Precedence -- set to bulk
-
- References -- set to the full set of message ids that are known (from data and the msgid option)
-
- In-Reply-To -- set to msg id or the msgid from data
-
- X-Project-PR-Message -- set to pr_msg with 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(message => $message,
recipients => [@recipients],
envelope_from => 'don@debian.org',
);
- message -- message to send out
-
- recipients -- recipients to send the message to. If undefed or an empty arrayref, will use '-t' to parse the message for recipients.
-
- envelope_from -- envelope_from for outgoing messages
-
- encode_headers -- encode headers using RFC1522 (default)
-
- 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.]
Returns true on success, false on failures. All errors are indicated using warn.
$message = encode_heeaders($message);
RFC 1522 encodes the headers of a message
rfc822_date
Return the current date in RFC822 format in the UTC timezone
_send_message($message,@sendmail_args);
Private function that actually calls sendmail with @sendmail_args and sends message $message.
dies with errors, so calls to this function in send_mail_message should be wrapped in eval.
<<