The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Carp::Mailer - Traps die and warn signals and dispatch emails to someone.

AUTHOR

Igor Sutton Lopes <igor@izut.com>

SYNOPSIS

Use it to notify someone if an error occurrs in your application.

 use Carp::Mailer (
    recipients => [qw/igor@izut.com/],
    subject    => "%s execution had errors! Check it!",
 )

REQUIRES

Text::Template, Mail::Mailer

DESCRIPTION

Carp::Mailer is an error reporting module. It will trap any warn or die signals and then dispatch an email to specified recipients the message the signal threw.

OPTIONS

recipients

Must be a list reference to all recipients the errors should be sent.

Example

 use Carp::Mailer (
   recipients => [qw/first@domain.com second@domain.com/],
 );
subject

The format of the subject the message will have. The placeholder %s will be substituted by the application's file path.

Example

 use Carp::Mailer (
   subject => "An error occurred when executing %s";
 );
body

The format of the body the message will have. At this time, it's available only {$application} and {$message} placeholders.

Example

 use Carp::Mailer (
   message => 'An error occurred while executing {$application}:\n\n{$message}',
 );
method

The method Mail::Mailer will use to deliver the messages. Check Mail::Mailer documentation to check the available methods.

Example

 use Carp::Mailer (
   method => 'sendmail',
 );
relay

This option is used if the method option was set as smtp. It specifies the mail relay server Mail::Mailer will use to deliver the messages.

Example

 use Carp::Mailer (
   method => 'smtp',
   relay => 'mail.domain.com',
 );