PHPackages                             tightr/laravel-mail-template - 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. [Templating &amp; Views](/categories/templating)
4. /
5. tightr/laravel-mail-template

ActiveLibrary[Templating &amp; Views](/categories/templating)

tightr/laravel-mail-template
============================

A mail template driver to send emails with

v1.1.2(6y ago)0753MITPHPPHP ^7.2

Since Mar 13Pushed 6y agoCompare

[ Source](https://github.com/tightr/laravel-mail-template)[ Packagist](https://packagist.org/packages/tightr/laravel-mail-template)[ Docs](https://github.com/tightr/laravel-mail-template)[ RSS](/packages/tightr-laravel-mail-template/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (4)Dependencies (14)Versions (5)Used By (0)

A laravel mail template driver to send emails with
==================================================

[](#a-laravel-mail-template-driver-to-send-emails-with)

[![Latest Version](https://camo.githubusercontent.com/ff332cf1280cd271c4501df0380b800dffaa377f676eaf294abc36630f539636/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5469676874722f6c61726176656c2d6d61696c2d74656d706c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tightr/laravel-mail-template)[![Total Downloads](https://camo.githubusercontent.com/68e66962d82be597d8a3ee5a1b0fcdfba8b39e139c1f9bb618e8f16cf4891d15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5469676874722f6c61726176656c2d6d61696c2d74656d706c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tightr/laravel-mail-template)[![Build Status](https://camo.githubusercontent.com/9bc05b16dc24e019b200daa9f942338c4d5d7dc70082c09d5e1c7b9d5f60cad8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5469676874722f6c61726176656c2d6d61696c2d74656d706c6174652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tightr/laravel-mail-template)

This package is a fork from [the original package by DansMaCulotte](https://github.com/dansmaculotte/laravel-mail-template).

> This package allows you to send emails via mail service providers template's engine.

There are 5 drivers available:

- [Mandrill](https://mandrillapp.com/api/docs/)
- [Mailjet](https://dev.mailjet.com/guides/#about-the-mailjet-api)
- [Sendgrid](https://sendgrid.com/docs/api-reference/)
- [Mailgun](https://documentation.mailgun.com/en/latest/api_reference.html)
- [SendinBlue](https://developers.sendinblue.com/docs)

There is also and `log` and `null` driver for testing and debug purpose.

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

[](#installation)

### Requirements

[](#requirements)

- PHP 7.2

You can install the package via composer:

```
composer require tightr/laravel-mail-template
```

The package will automatically register itself.

To publish the config file to config/mail-template.php run:

```
php artisan vendor:publish --provider="Tightr\MailTemplate\MailTemplateServiceProvider"
```

Finally, install the email service package needed:

- Mailjet

```
composer require mailjet/mailjet-apiv3-php
```

- Mandrill

```
composer require mandrill/mandrill
```

- SendGrid

```
composer require sendgrid/sendgrid
```

- Mailgun

```
composer require mailgun/mailgun-php
```

- SendinBlue

```
composer require sendinblue/api-v3-sdk
```

Usage
-----

[](#usage)

Configure your mail template driver and credentials in `config/mail-template.php`.

### Basic

[](#basic)

After you've installed the package and filled in the values in the config-file working with this package will be a breeze. All the following examples use the facade. Don't forget to import it at the top of your file.

```
use MailTemplate;
```

```
$mailTemplate = MailTemplate::setSubject('Welcome aboard')
    ->setFrom(config('mail.name'), config('mail.email'))
    ->setRecipient('Recipient Name', 'recipient@email.com')
    ->setLanguage('en')
    ->setTemplate('welcome-aboard')
    ->addAttachment(storage_path('pdf/invoice.pdf'), 'invoice-42.pdf')
    ->trackClicks(true)
    ->trackOpens(true)
    ->setVariables([
        'first_name' => 'Recipient',
    ]);

$response = $mailTemplate->send();
```

If an error occurs in the send method it will throw a `SendError::responseError` exception.

### Via Notification

[](#via-notification)

Create a new notification via php artisan:

```
php artisan make:notification WelcomeNotification
```

Set `via` to `MailTemplateChannel`:

```
/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{
    return [MailTemplateChannel::class];
}
```

Implement `toMailTemplate` method and prepare your template:

```
public function toMailTemplate($notifiable)
{
    return MailTemplate::setSubject('Welcome aboard')
        ->setFrom(config('mail.name'), config('mail.email'))
        ->setRecipient('Recipient Name', 'recipient@email.com')
        ->setLanguage('en')
        ->setTemplate('welcome-aboard')
        ->addAttachment(storage_path('pdf/invoice.pdf'), 'invoice-42.pdf')
        ->trackClicks(true)
        ->trackOpens(true)
        ->setVariables([
           'first_name' => 'Recipient',
        ]);
}
```

And that's it. When `MailTemplateChannel` will receive the notification it will automatically call `send` method from `MailTemplate` facade.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.5% of commits — single point of failure

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 ~0 days

Total

3

Last Release

2251d ago

### Community

Maintainers

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

---

Top Contributors

[![gaelreyrol](https://avatars.githubusercontent.com/u/498465?v=4)](https://github.com/gaelreyrol "gaelreyrol (31 commits)")[![pmayet](https://avatars.githubusercontent.com/u/1593076?v=4)](https://github.com/pmayet "pmayet (9 commits)")

---

Tags

laravelmailtemplate

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/tightr-laravel-mail-template/health.svg)

```
[![Health](https://phpackages.com/badges/tightr-laravel-mail-template/health.svg)](https://phpackages.com/packages/tightr-laravel-mail-template)
```

###  Alternatives

[dansmaculotte/laravel-mail-template

A mail template driver to send emails with

353.0k](/packages/dansmaculotte-laravel-mail-template)[brackets/admin-ui

Administration user interface template

29258.6k3](/packages/brackets-admin-ui)[yansongda/laravel-notification-wechat

Laravel Wechat Notifications Driver

831.4k](/packages/yansongda-laravel-notification-wechat)[sineld/bladeset

A very simple blade extension which allows variables to be set within blade templates.

4423.2k](/packages/sineld-bladeset)[larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

143.7k](/packages/larablocks-pigeon)[muratbsts/mail-template

This package is a easy to use mail template collection for Laravel 5.x.

191.3k](/packages/muratbsts-mail-template)

PHPackages © 2026

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