davidvandertuijn/laravel-mandrill-driver

This package is abandoned and no longer maintained. No replacement package was suggested.

Laravel Mandrill Mailer

2.2 2024-11-22 14:47 UTC

This package is auto-updated.

Last update: 2024-11-22 14:51:37 UTC


README

This package is deprecated and will not be maintained.

Laravel Mandrill Driver

Total Downloads Latest Stable Version License

Laravel Mandrill Driver

This library adds Mandrill support to Laravel and the ability to capture the Mandrill response via an Event.

Install

composer require davidvandertuijn/laravel-mandrill-driver

Add the MAIL_MAILER and MANDRILL_SECRET environment variables:

MAIL_MAILER=mandrill
MANDRILL_SECRET=your-api-key

Add mandrill config to the config/services.php file:

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

Add mandrill option to the config/mail.php "mailers" array:

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

Publish config:

php artisan vendor:publish --provider="Davidvandertuijn\LaravelMandrillDriver\MandrillServiceProvider"

Mandrill Message Sent Event (optional)

The Event should be registered in the App\Providers\EventServiceProvider.php $listen Array:

use App\Listeners\Mandrill\MessageSent as MandrillMessageSentListener;
use Davidvandertuijn\LaravelMandrillDriver\app\Events\MandrillMessageSent as MandrillMessageSentEvent;

class EventServiceProvider extends ServiceProvider
{
    protected $listen = [
        MandrillMessageSentEvent::class => [
            MandrillMessageSentListener::class
        ],
    ];
}

Define the listener in App\Listeners\Mandrill\MessageSent.php:

namespace App\Listeners\Mandrill;

class MessageSent
{
    public function handle($event)
    {
        // Mandrill ID
        // $event->response[0]->_id
    }
}