NAME

Exception::Reporter::Sender::Email - an report sender that sends detailed dumps via email

VERSION

version 0.004

SYNOPSIS

my $sender = Exception::Reporter::Sender::Email->new({
  from => 'root',
  to   => 'Beloved SysAdmins <sysadmins@example.com>',
});

OVERVIEW

This is the only report sender you'll probably ever need.

It turns the report into a multipart email message and sends it via email.

Each set of summaries is turned into a MIME message part. If a dumpable has become more than one summary, its summaries will be children of a multipart/related part. Otherwise, its summary will become a part of the kind indicated in the summary.

The ident of the first summary will be used for the subject of the message.

The GUID of the exception report (the thing returned by the reporter's report_exception method) is used as the local part of the email message's Message-ID.

Every reported message has a In-Reply-To header formed by combining a slightly-munged version of the ident and the reporter. This means that similar exception report emails will thread together in a thread-capable email reader.

send_report

$email_reporter->send_report(\@summaries, \%arg, \%internal_arg);

This method builds a multipart email message from the given summaries and sends it.

%arg is the same set of arguments given to Exception::Reporter's report_exception method. Arguments that will have an effect include:

extra_rcpts  - an arrayref of extra envelope recipients
reporter     - the name of the program reporting the exception
handled      - if true, the reported exception was handled and the user
               saw a simple error message; sets X-Exception-Handled header
               and adds a text part at the beginning of the report,
               calling out the "handled" status"

%internal_arg contains data produced by the Exception::Reporter using this object. It includes the guid of the report and the caller calling the reporter.

The mail is sent with the send_email method, which can be replaced in a subclass.

The return value of send_report is not defined.

METHODS

send_email

$sender->send_email($email, \%env);

This method expects an email object (such as can be handled by Email::Sender) and a a hashref that will have these two keys:

from - an envelope sender
to   - an arrayref of envelope recipients

It sends the email. It should not throw an exception on failure. The default implementation uses Email::Sender. If the email injection fails, a warning is issued.

AUTHOR

Ricardo Signes <rjbs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Ricardo Signes.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.