Laravel 9 โ€“ 13
PHP 7.4+
Low commit activity in last 18 months
A long-lived project that still receives updates
Laravel package for Mailjet API V3 and Laravel Mailjet Mail Transport
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

fakerphp/faker
~1
mockery/mockery
0.9.*|^1.0
3.6|^4.0|^5.0|^6.0|^8.0|^9.0|^10.0|^11.0
phpcompatibility/php-compatibility
^9.3
phpunit/phpunit
~7.0|^8.0|^9|^10.0|^11.0|^12.0|^13.0

Runtime

^9.0|^10.0|^11.0|^12.0|^13.0
mailjet/mailjet-apiv3-php
^1.5.6|^1.5
symfony/http-client
^6.0|^7.1|^8.0
symfony/mailjet-mailer
^6.0|^7.0|^8.0
 Project Readme
Mailjet

Laravel Mailjet

Fluent Mailjet APIย v3 integration & mail transport for Laravel.

Send transactional mail through the Laravel Mail facade, or talk to the full Mailjet REST API โ€” contacts, lists, campaigns, templates and webhooks โ€” with an expressive wrapper.


Latest Version Total Downloads PHP Version Laravel License


Table of contents

  • Features
  • Requirements
  • Installation
  • Configuration
  • Sending mail with the Mailjet transport
  • Using the Mailjet API
  • Optional service providers
  • Sandbox mode
  • Documentation
  • Testing
  • Contributing
  • License

Features

  • ๐Ÿ“จ Drop-in mail transport โ€” set one env var and every Mailable / Notification goes through Mailjet.
  • ๐Ÿงฉ Full API v3 wrapper โ€” low-level get / post / put / delete plus high-level helpers, built on the official mailjet/mailjet-apiv3-php client.
  • ๐Ÿ—‚๏ธ Resource managers โ€” dedicated, injectable services for contacts, lists, metadata, campaigns, campaign drafts, templates and event callbacks.
  • ๐Ÿงช Sandbox mode โ€” validate payloads in CI and local development without sending a single email.
  • โšก Zero-config setup โ€” package auto-discovery registers the provider and Mailjet facade for you.

Requirements

Package Supported versions
PHP 7.4 ยท 8.x
Laravel 9.x โ€“ 13.x
Symfony Mailer / Mailjet Mailer 6.x ยท 7.x ยท 8.x

Installation

composer require mailjet/laravel-mailjet

That's it. Package auto-discovery wires up the MailjetServiceProvider and the Mailjet facade automatically.

Manual registration (only if auto-discovery is disabled)

Laravel 11 and newer โ€” bootstrap/providers.php:

use Mailjet\LaravelMailjet\MailjetServiceProvider;

return [
    App\Providers\AppServiceProvider::class,
    MailjetServiceProvider::class,
];

Laravel 10 and older โ€” config/app.php:

'providers' => [
    // ...
    Mailjet\LaravelMailjet\MailjetServiceProvider::class,
],

'aliases' => [
    // ...
    'Mailjet' => Mailjet\LaravelMailjet\Facades\Mailjet::class,
],

Configuration

Grab your API key and secret from the Mailjet account settings.

1. Add your credentials to .env:

MAILJET_APIKEY=your_api_key
MAILJET_APISECRET=your_api_secret

MAIL_FROM_ADDRESS=you@example.com
MAIL_FROM_NAME="Your App"

# Optional โ€” process requests without actually sending
MAILJET_SANDBOX=false

2. Register the service in config/services.php:

'mailjet' => [
    'key'     => env('MAILJET_APIKEY'),
    'secret'  => env('MAILJET_APISECRET'),
    // filter_var keeps the "true"/"false" env string honest (handy in Docker)
    'sandbox' => filter_var(env('MAILJET_SANDBOX', false), FILTER_VALIDATE_BOOLEAN),
],

Need to tune the API URL, version, or the transactional/common/v4 clients? See the full configuration reference.

Sending mail with the Mailjet transport

1. Select the transport in .env:

MAIL_MAILER=mailjet

Laravel 6 and older use the MAIL_DRIVER key instead.

2. Declare the mailer in config/mail.php:

'mailers' => [
    // ...
    'mailjet' => [
        'transport' => 'mailjet',
    ],
],

3. Send as usual โ€” no Mailjet-specific code required:

use Illuminate\Support\Facades\Mail;

Mail::to($user)->send(new InvoicePaid($invoice));

Make sure the from address is a verified Mailjet sender. More patterns (Mailjet templates, variables, custom headers) live in the examples guide.

Using the Mailjet API

Import the facade:

use Mailjet\LaravelMailjet\Facades\Mailjet;

Low-level requests

Mailjet::get($resource, $args, $options);
Mailjet::post($resource, $args, $options);
Mailjet::put($resource, $args, $options);
Mailjet::delete($resource, $args, $options);

Every call returns a Mailjet\Response, or throws a Mailjet\LaravelMailjet\Exception\MailjetException on an API error. Filter arguments are documented in the Mailjet API reference.

High-level helpers

Mailjet::getAllLists($filters);
Mailjet::createList($body);
Mailjet::getListRecipients($filters);
Mailjet::getSingleContact($id);
Mailjet::createContact($body);
Mailjet::createListRecipient($body);
Mailjet::editListrecipient($id, $body);

Custom requests

$client = Mailjet::getClient(); // the underlying \Mailjet\Client instance

Optional service providers

Each Mailjet resource has a focused, injectable manager. Register only the providers you use in config/app.php (or bootstrap/providers.php on Laravel 11+):

Service provider Manages Contract
Providers\ContactsServiceProvider Contacts, incl. deletion (API v4) ContactsV4Contract
Providers\ContactsListServiceProvider Contact lists ContactsListContract
Providers\ContactMetadataServiceProvider Contact properties / metadata ContactMetadataContract
Providers\CampaignServiceProvider Campaigns CampaignContract
Providers\CampaignDraftServiceProvider Campaign drafts CampaignDraftContract
Providers\TemplateServiceProvider Templates TemplateServiceContract
Providers\EventCallbackUrlServiceProvider Event (webhook) callback URLs EventCallbackUrlContract
// config/app.php
'providers' => [
    // ...
    Mailjet\LaravelMailjet\Providers\ContactsServiceProvider::class,
],

Then resolve the manager wherever you need it:

use Mailjet\LaravelMailjet\Services\ContactsV4Service;

public function handle(ContactsV4Service $contacts)
{
    $contacts->delete(351406781);
}

Sandbox mode

With MAILJET_SANDBOX=true, Mailjet validates the request and returns a successful response without delivering any email โ€” ideal for staging environments and automated tests.

MAILJET_SANDBOX=true

Details in the configuration reference.

Documentation

Resource Link
Configuration reference docs/configuration.md
Examples (campaigns, templates, Mailables) docs/usage.md
Full docs site https://mailjet.github.io/laravel-mailjet/
Mailjet API v3 https://dev.mailjet.com/
PHP API client https://github.com/mailjet/mailjet-apiv3-php

Testing

composer install
bin/phpunit

Contributing

Issues and pull requests are welcome โ€” see CONTRIBUTING.md.

License

Released under the MIT License.