25th/zf2-exception-mailer-module

There is no license information available for the latest version (0.1.3) of this package.

Zend Framework 2 Module that provides a Simple Exception Mailer functionality

0.1.3 2018-06-12 07:54 UTC

This package is not auto-updated.

Last update: 2024-11-22 09:57:33 UTC


README

A simple ZF2 Module for sending Mails if Exceptions happen on production systems. In it's simplest configuration it just sends the stack trace of the Exception. But you can also render views and send html mails instead.

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

php composer.phar require 25th/zf2-exception-mailer-module
# (When asked for a version, type `0.*`)

Then add ExceptionMailer to your config/application.config.php.

Installation without composer is not officially supported and requires you to manually install all dependencies that are listed in composer.json

Configuration

To configure the Mailer use your application config:

<?php
return array(
	// Exception Stuff
	'exception_mailer' => array(
		// Mail
		'send' => true,
		'sender' => 'your-sender-address@mail.com',
		'recipients' => array(
			'your-recipient-address@mail.com',
		),
		'subject' => 'My Exception Mailer',
		'exceptionInSubject' => false

		// HTML Templates
		'useTemplate' => false,
		'template' => 'error/index'
	),
);

Ignore Exceptions

It's also possible to ignore certain Exceptions. Just let them implement the IgnoreExceptionInterface and they will be ignored.

HTML Emails

For HTML Emails set useTemplate to true and use the template parameter for your template configuration.

If you want to use a different template f.e. "error/mail" you also have to define it in the view_manager => template_map array with the correct position to it

<?php
return array(
	...
	'view_manager' => array(
		'template_map'        => array(
			...
			'error/mail'              => __DIR__ . '/../view/error/mail.phtml', // Exception_Mailer
			...
		),
	),
	...
);