Mojolicious::Plugin::MailException(3pm)

Mojolicious::Plugin::MailException3pm

Mojolicious plugin to send crash information by email

Usage

    package MyServer;
    use Mojo::Base 'Mojolicious';
    sub startup {
        my ($self) = @_;
        $self->plugin(MailException => {
            from    => '[email protected]',
            to      => '[email protected], [email protected]',
            subject => 'My site crashed!',
            headers => {
                'X-MySite' => 'crashed'
            }
        });
    }

Overview

The plugin catches all exceptions, packs them into email and sends them to email.

There are some plugin options:

from

From-address for email (default root@localhost)

to

To-address(es) for email (default webmaster@localhost)

subject

Subject for crash email

headers

Hash with headers that have to be added to mail

send

Subroutine that can be used to send the mail, example:

    sub startup {
        my ($self) = @_;
        $self->plugin(MailException => {
            send => sub {
                my ($mail, $exception) = @_;
                $mail->send;    # prepared MIME::Lite object
            }
        });
    }

In the function You can send email by yourself and (or) prepare and send Your own mail (sms, etc) message using $exception object. See Mojo::Exception.

The plugin provides additional method (helper) mail_exception.

    $cx->mail_exception('my_error', { 'X-Add-Header' => 'value' });

You can use the helper to raise exception with additional mail headers.

VCS

The plugin is placed on github <https://github.com/dr-co/libmojolicious-plugin-mail_exception>.

Releases

6 releases since Debian 8 (Jessie); the text changed 2 times.

  1. 8
  2. 9–10
  3. 11–13

From libmojolicious-plugin-mailexception-perl 0.20-1.1 in Debian 13 (Trixie). Parsed by carta from the page's man source.