nextras/mail-panel

MailPanel is extension for Nette Framework which captures sent e-mails in development mode and shows them in debugger bar.

Installs: 5 028

Dependents: 0

Stars: 28

Watchers: 12

Forks: 4

Open Issues: 1

Language: PHP

v2.2.3 2015-08-22 09:22 UTC

README

Nette Debug panel for sent emails. Supports storing emails into

  • files
  • session

Based on http://git.yavanna.cz/p/mailpanel/ by Jan Drábek.

Installation

Install library via composer:

composer require nextras/mail-panel

Mailer has to be set as service "nette.mailer" in development configuration.

services:
    nette.mailer: Nextras\MailPanel\FileMailer(%tempDir%/mails)
#   nette.mailer: Nextras\MailPanel\SessionMailer

Add MailPanel to debug bar:

tracy:
    bar:
        - Nextras\MailPanel\MailPanel(%tempDir%)

Usage

Messages has to be sent by injected mailer or created by Nette mail factory.

class ExamplePresenter extends BasePresenter
{

    private $mailer;

    public function injectMailer(Nette\Mail\IMailer $mailer)
    {
        $this->mailer = $mailer;
    }

    public function renderDefault()
    {
        $mail = new Nette\Mail\Message;
        $mail->setFrom('foo@bar.net');
        $mail->addTo('john@doe.cz');
        $mail->setSubject('Subject');
        $mail->setBody('Message body');

        $this->mailer->send($mail);
    }

}