laravelflare / mail-debug by AdenFraser

11,046
13
4
Package Data
Maintainer Username: AdenFraser
Package Create Date: 2016-04-07
Package Last Update: 2017-04-21
Language: PHP
License: MIT
Last Refreshed: 2024-05-03 15:11:13
Package Statistics
Total Downloads: 11,046
Monthly Downloads: 94
Daily Downloads: 0
Total Stars: 13
Total Watchers: 4
Total Forks: 1
Total Open Issues: 0

Mail Debug

This package is designed to help you easily preview and debug emails sent by your Laravel application in the browser. It provides a pop-up email preview on the subsequent page request after an email has been triggered by your application.

It is based off of themsaid's Laravel Mail Preview Driver which is extremely helpful for more persistent logging and previewing (including .eml files).

Example Animation

Latest Stable Version Total Downloads Latest Unstable Version License

Quick Start Guide

Install the package into your project using composer:

    composer require "laravelflare/mail-debug"

Add the Mail Debug Service Provider to your Applications Service Providers list:

    LaravelFlare\MailDebug\MailDebugServiceProvider::class,

Publish the configuration file using:

    php artisan vendor:publish

In your .env file, set your mail driver to debug:

    MAIL_DRIVER=debug

How It Works

By registering your mail driver as debug, when an email is 'sent' Mail Transport stores the contents of the email to the application storage folder. It then sets the filename of the stored email into the Session.

On the next request (page load) the Mail Debug middleware will check the Session to determine if an email is available to be previewed. If it is, it will trigger the email to be displayed in a browser pop up window.

Note: You may need to allow pop-ups in your browser to see the preview emails.

Configuration Options

Path

This is the Mail Preview Storage Path to store mail preview files in. By default this is /storage/email-previews, but you can use whatever you like!

Lifetime

This is the amount of time to store the preview files for (in minutes). By default this is one minute but can be increased if you would like a certain level of persistence.

Improvements Required

  • Implement Tests

  • Currently this only works for the last mail sent in a request. If your request cycle sends several emails, only the final email will be displayed on the subsequent page request pop-up.