Laravel Mandrill Driver

therobfonz/laravel-mandrill-driver image

Laravel Mandrill Driver stats

Downloads
1.9M
Stars
76
Open Issues
2
Forks
32

View on GitHub →

Mandrill Driver for Laravel 9+

Laravel Mandrill Driver

This package re-enables Mandrill driver functionality using the Mail facade in Laravel 6+.

To install the package in your project, you need to require the package via Composer:

composer require therobfonz/laravel-mandrill-driver

To add your Mandrill secret key, add the following lines to config\services.php and set MANDRILL_KEY in your env:

'mandrill' => [
'secret' => env('MANDRILL_KEY'),
],

You can also add custom Mandrill headers to each email sent, for this you need to add the headers array in the following format to config\services.php:

'mandrill' => [
'secret' => env('MANDRILL_KEY'),
'headers' => [
'header-example-x' => env('MANDRILL_HEADER_X'),
'header-example-y' => env('MANDRILL_HEADER_Y'),
]
],

all the valid options in Mandrill docs at: https://mailchimp.com/developer/transactional/docs/smtp-integration/#customize-messages-with-smtp-headers

Accessing Mandrill message ID

Mandrill message ID's for sent emails can be accessed by listening to the MessageSent event. It can then be read either from the sent data or the X-Message-ID header.

 
Event::listen(\Illuminate\Mail\Events\MessageSent::class, function($event)
{
$messageId = $event->sent->getMessageId();
$messageId = $event->message->getHeaders()->get('X-Message-ID');
}

Versions

Laravel Version Mandrill package version
10 5.x
9 4.x
6, 7, 8 3.x

Laravel 7+ Installation

composer require therobfonz/laravel-mandrill-driver:^3.0

Add the Mandrill mailer to your config\mail.php:

'mandrill' => [
'transport' => 'mandrill',
],

Set the MAIL_MAILER value in your env to mandrill to enable it:

MAIL_MAILER=mandrill

Laravel 6 Installation

As before, you can set the MAIL_DRIVER value in your env to mandrill to enable it:

MAIL_DRIVER=mandrill

Lumen Installation

Add the following line to bootstrap/app.php

$app->register(LaravelMandrill\MandrillServiceProvider::class);
luisdalmolin photo

Senior Software Engineer at Aryeo

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Therobfonz Laravel Mandrill Driver Related Articles

Performance: SMTP driver vs. API drivers image

Performance: SMTP driver vs. API drivers

Read article
Effortlessly Send Email  with Mandrill (Sponsor) image

Effortlessly Send Email with Mandrill (Sponsor)

Read article
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Honeybadger logo

Honeybadger

Simple developer-focused application monitoring for Laravel. Error tracking, log management, uptime monitoring, status pages, and more!

Honeybadger
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
LoadForge logo

LoadForge

Scalable load testing for web apps & APIs. Simulate real-world traffic and identify breaking points and performance limits with powerful, scalable load tests designed for Laravel.

LoadForge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell