PHPackages                             distilleries/mailersaver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. distilleries/mailersaver

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

distilleries/mailersaver
========================

Override helper Mailer from laravel to hook the sender

2.6.0(7y ago)03.4k2MITHTMLPHP ^7.1.3

Since Feb 16Pushed 7y ago3 watchersCompare

[ Source](https://github.com/Distilleries/MailerSaver)[ Packagist](https://packagist.org/packages/distilleries/mailersaver)[ RSS](/packages/distilleries-mailersaver/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (20)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/87b42a14b6b8673122dfa7b0f71e62dd5557dad067ad34dbec368bf07e4752ad/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f4d61696c657253617665722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/MailerSaver/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/e4f27b7398304c5043dab21281c933446840101e8b88f4c358f87636d8fc6102/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f4d61696c657253617665722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/MailerSaver/?branch=master)[![Build Status](https://camo.githubusercontent.com/54d6af7268f60645ca641a6915cff75e70036a732ddfcf86021b0e166bdb55f0/68747470733a2f2f7472617669732d63692e6f72672f44697374696c6c65726965732f4d61696c657253617665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Distilleries/MailerSaver)[![Total Downloads](https://camo.githubusercontent.com/b5c2aa87f865dc5f4bd89e1dc858f45aebeeafa3a25a54bc9f4316e6ea2df542/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f6d61696c657273617665722f646f776e6c6f616473)](https://packagist.org/packages/distilleries/mailersaver)[![Latest Stable Version](https://camo.githubusercontent.com/206e7345b637ee7a02c2e9c847c8efd42f5c2880b391e2e567d170e8ab22e339/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f6d61696c657273617665722f76657273696f6e)](https://packagist.org/packages/distilleries/mailersaver)[![License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE)

Laravel 5 MailerSaver
=====================

[](#laravel-5-mailersaver)

Mailer saver extend the laravel 5 mailer.

- Add the possibility to override the to,cc,bcc of your mail without modify your implementation.
- Add the possibility to get your template mail, subject, cc, bcc and type from a model.

Table of contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Config file](#config-file)
3. [View](#view)
4. [Send an email](#send-an-email)

Installation
------------

[](#installation)

Add on your composer.json

```
    "require": {
        "distilleries/mailersaver": "2.*",
    }
```

run `composer update`.

Add Service provider to `config/app.php`:

```
    'providers' => [
        // ...
       Distilleries\MailerSaver\MailerSaverServiceProvider::class,
       Wpb\String_Blade_Compiler\ViewServiceProvider::class,
    ],
```

And Facade (also in `config/app.php`) replace the laravel facade `Mail`

```
    'aliases' => [
        // ...
       'Mail' => 'Distilleries\MailerSaver\Facades\Mail',
    ]
```

You need to provide a model of data, simply add on your register method a new instance of your model in your `app/Providers/AppServiceProvider.php`:

```
    public function register()
	{
		$this->app->singleton('Distilleries\MailerSaver\Contracts\MailModelContract', function ($app) {
            return new App\Email;
        });

	}
```

In this case I return a Email model instance. This model just implement the contract `Distilleries\MailerSaver\Contracts\MailModelContract`.

To Publish the model:

```
php artisan vendor:publish --provider="Distilleries\MailerSaver\MailerSaverServiceProvider" --tag="models"

```

To Publish the migration:

```
php artisan vendor:publish --provider="Distilleries\MailerSaver\MailerSaverServiceProvider" --tag="migrations"

```

Config file
-----------

[](#config-file)

You can publish the config file with the command line:

```
php artisan vendor:publish --provider="Distilleries\MailerSaver\MailerSaverServiceProvider"

```

```
    return [
        'template' => 'mailersaver::default',
        'override' => [
            'enabled' => env('MAILERSAVER_ENABLED', false),
            'to' => env('MAILERSAVER_TO', 'default1@mailto.com,default2@mailto.com'),
            'cc' => env('MAILERSAVER_CC', ''),
            'bcc' => env('MAILERSAVER_BCC', ''),
        ],
    ];
```

FieldDescriptiontemplateGlobal template when you put the content of your mail.overrideAn array with all the config to hoock the mail send.enabledEnable the override of the mail. If in true that send the email with the to, cc, bcctoUse to send an email when the override parameter is set to trueccUse to send an email when the override parameter is set to truebccUse to send an email when the override parameter is set to trueView
----

[](#view)

To override the view you can give a new template on the configuration or modify the current one. Before modify it you have to publish it:

```
php artisan vendor:publish --provider="Distilleries\MailerSaver\MailerSaverServiceProvider" --tag="views"

```

Send an email
-------------

[](#send-an-email)

It's exactly the same than the laravel mailer.

Example:

```
Mail::send('emails.welcome', ['key' => 'value'], function ($message) {
    $message->to('foo@example.com', 'John Smith')->subject('Welcome!');
});
```

If the override is set to true email is send to another `to` email address.

Troubleshooting
---------------

[](#troubleshooting)

If composer update --require-dev refuse to install, remove illuminate/\* from vendor before the install or just remove vendor and start fresh.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~86 days

Recently: every ~261 days

Total

17

Last Release

2729d ago

Major Versions

1.0.1 → 2.0.02015-02-18

1.1.2 → 2.1.12015-04-30

PHP version history (4 changes)1.0.0PHP &gt;=5.5.0

1.1.2PHP &gt;=5.4.0

2.4.0PHP &gt;=5.6.4

2.6.0PHP ^7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1edc17683ed39a2cc6dbe453c2c5aaa63468fc5b54f13941f260ebe260da211?d=identicon)[Kezho](/maintainers/Kezho)

---

Top Contributors

[![mfrancois](https://avatars.githubusercontent.com/u/654224?v=4)](https://github.com/mfrancois "mfrancois (27 commits)")[![bbs-smuller](https://avatars.githubusercontent.com/u/18079210?v=4)](https://github.com/bbs-smuller "bbs-smuller (9 commits)")[![mfrancoisbbs](https://avatars.githubusercontent.com/u/133215273?v=4)](https://github.com/mfrancoisbbs "mfrancoisbbs (9 commits)")[![jeefave](https://avatars.githubusercontent.com/u/5779391?v=4)](https://github.com/jeefave "jeefave (7 commits)")[![mikaelpopowicz](https://avatars.githubusercontent.com/u/5689944?v=4)](https://github.com/mikaelpopowicz "mikaelpopowicz (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/distilleries-mailersaver/health.svg)

```
[![Health](https://phpackages.com/badges/distilleries-mailersaver/health.svg)](https://phpackages.com/packages/distilleries-mailersaver)
```

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[illuminate/notifications

The Illuminate Notifications package.

483.0M967](/packages/illuminate-notifications)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
