Componette

Componette

romanmatyus

romanmatyus / FileMailer

Addon for catch mails in Nette to filesystem and showing it in debug bar.

download-cloud-line composer require rm/filemailer

FileMailer

E-mails catching addon for Nette Framework. Emails are stored into files and shown in Tracy bar.

!WARNING! - After setting up this addon, all e-mails are not sent, but ONLY stored on filesystem and shown in Tracy bar.

Demo

Killer features

  • Simple instalation
  • Extensive configuration options
  • Full access to headers
  • Plain text and HTML output
  • Possibility to download the attachments
  • Parser caching

Installation

Add package to your project by the Composer:

composer require rm/filemailer

or download addon manually from GitHub and unpack it in place indexed by RobotLoader.

Configuration

The addon consists of two parts. The first one is the FileMailer which replaces the IMailer service and stores e-mails to filesystem. The second one is the MailPanel which is the Tracy bar panel and shows e-mails stored by FileMailer.

Default options are used in following examples.

Setup by extension

Register new compiler extension in config.neon and optionally configure:

extensions:
	mailer: RM\MailPanel\DI\MailPanelExtension

mailer:
	newMessageTime: '-2 seconds'    # how long consider email as new
	show: [subject, from, to]       # which headers show in overview
	autoremove: '-5 seconds'        # how old emails are purged
	hideEmpty: yes                  # hide bar icon when no emails?
	debugger: yes                   # enable Tracy bar
	tempDir: '%tempDir/mails'       # change e-mails store directory

Manual setup

Replace the Nette's default IMailer service and register Tracy bar panel:

services:
	mail.mailer: RM\FileMailer(%tempDir%/mails)

	mailerPanel:
		class: RM\MailPanel
		autowired: no
		setup:
			- setFileMailer(@mail.mailer)	# required
			- $newMessageTime('-5 seconds')
			- $show([subject, from, to])
			- $autoremove('-5 seconds')
			- $hideEmpty(yes)

tracy:
	bar:
		- @mailerPanel

No release at this moment. Try to create first one.

Componette Componette felix@nette.org