PHPackages                             welp/mailjet-swiftmailer - 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. welp/mailjet-swiftmailer

Abandoned → [mailjet/mailjet-swiftmailer](/?search=mailjet%2Fmailjet-swiftmailer)Library[Mail &amp; Notifications](/categories/mail)

welp/mailjet-swiftmailer
========================

A SwiftMailer transport implementation for Mailjet

2.0.0(6y ago)1616822[4 PRs](https://github.com/mailjet/MailjetSwiftMailer/pulls)MITPHPPHP &gt;=7.0CI failing

Since Jun 7Pushed 4y ago9 watchersCompare

[ Source](https://github.com/mailjet/MailjetSwiftMailer)[ Packagist](https://packagist.org/packages/welp/mailjet-swiftmailer)[ Docs](https://github.com/mailjet/MailjetSwiftMailer)[ RSS](/packages/welp-mailjet-swiftmailer/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (4)Versions (17)Used By (0)

MailjetSwiftMailer
==================

[](#mailjetswiftmailer)

[![Build Status](https://camo.githubusercontent.com/9ce62f0c79f9292f81a2f1c4e8c903c09a7633ccb1d156f78fad7cfd2151da86/68747470733a2f2f7472617669732d63692e6f72672f6d61696c6a65742f4d61696c6a657453776966744d61696c65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mailjet/MailjetSwiftMailer)[![Packagist](https://camo.githubusercontent.com/f424fc4b68ae13f6ab9112ba2e022891d55b49505008cd09858d0810d08eea4c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61696c6a65742f6d61696c6a65742d73776966746d61696c65722e737667)](https://packagist.org/packages/mailjet/mailjet-swiftmailer)[![Packagist](https://camo.githubusercontent.com/77c87d9069cbec8ced570b4ad6b20494be3549b02369c3ea3ac5e52050789a77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61696c6a65742f6d61696c6a65742d73776966746d61696c65722e737667)](https://packagist.org/packages/mailjet/mailjet-swiftmailer)[![GitHub license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/mailjet/MailjetSwiftMailer/blob/master/LICENSE.md)

A SwiftMailer transport implementation for Mailjet (\[NEW\] we now support send API v3.1 ) [Mailjet Send API v3.1](https://dev.mailjet.com/guides/#send-api-v3-1-beta)*Compatible Mailjet send API V3 and V3.1*

If you found any problem, feel free to open an issue!

TODO
----

[](#todo)

- Adding URL tags
- Sandbox Mode
- Improve unit-tests (lots of code duplications)

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

[](#installation)

Require the package with composer

```
composer require mailjet/mailjet-swiftmailer
```

Usage Example
-------------

[](#usage-example)

```
$transport = new MailjetTransport($dispatchEvent, $apiKey, $apiSecret);
$transport->setClientOptions(['url' => "api.mailjet.com", 'version' => 'v3.1', 'call' => true]);

$transport->send($message);
```

(Send API v3 is selected by default)

Mailjet client custom configuration
-----------------------------------

[](#mailjet-client-custom-configuration)

You can pass an array in transport's constructor or use `setClientOptions` function:

```
$clientOptions = ['url' => "api.mailjet.com", 'version' => 'v3.1', 'call' => false];
$transport = new MailjetTransport($dispatchEvent, $apiKey, $apiSecret, $clientOptions);

or

$transport->setClientOptions(['url' => "api.mailjet.com", 'version' => 'v3.1', 'call' => true]);
```

Properties of $options:

- url (Default: api.mailjet.com) : domain name of the API
- version (Default: v3) : API version (only working for Mailjet API V3 +)
- call (Default: true) : turns on(true) / off the call to the API
- secured (Default: true) : turns on(true) / off the use of 'https'

Mailjet custom headers
----------------------

[](#mailjet-custom-headers)

It is possible to set specific Mailjet headers or custom user-defined headers, through SwiftMailer.

For example:

```
$headers = $message->getHeaders();

$headers->addTextHeader('X-MJ-TemplateID', $templateId);
$headers->addTextHeader('X-MJ-TemplateLanguage', true);
$vars = array("myFirstVar" => "foo", "mySecondVar" => "bar");
$headers->addTextHeader('X-MJ-Vars', json_encode($vars));
```

Note: You need to `json_encode`your array of variables in order to be compatible with SMTP transport.

- [Mailjet Email Headers documentation v3](https://dev.mailjet.com/guides/#send-api-json-properties)
- [Mailjet Email Headers documentation v3.1](https://dev.mailjet.com/guides/#adding-email-headers)

Mailjet bulk sending
--------------------

[](#mailjet-bulk-sending)

```
$emails = ['f001@bar.com', 'f002@bar.com', 'f003@bar.com', 'f004@bar.com', 'f005@bar.com', 'f006@bar.com', ...]

$messages = [];
foreach ($emails as $email) {
    $message = new \Swift_Message('Test Subject', 'Foo bar', 'text/html');
    $message
        ->addTo($email)
        ->addFrom('from@example.com', 'From Name')
        ->addReplyTo('reply-to@example.com', 'Reply To Name')
    ;

    array_push($messages, $message);
}
$transport = new MailjetTransport($dispatchEvent, $apiKey, $apiSecret);
$result = $transport->bulkSend($messages);
```

Note: does not work with Spool (SwiftMailer removed bulkSend from its API).

Integration in Symfony
----------------------

[](#integration-in-symfony)

If you want to use MailjetTransport in your Symfony project follow these small steps:

1. `composer require mailjet/mailjet-swiftmailer`
2. Into your `services.yml`, register MailjetTransport:

```
swiftmailer.mailer.transport.mailjet:
    class: Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport
    arguments:
        - "@swiftmailer.transport.eventdispatcher.mailjet"
        - "%mailjet.api_key%"
        - "%mailjet.secret_key%"
```

Note: We set `mailjet.api_key` and `mailjet.secret_key` into parameters.yml

3. Finally, configure SwiftMailer in your `config.yml`:

```
# Swiftmailer Configuration
swiftmailer:
    transport: mailjet
```

Note: You can also inject your own `Mailjet\Client`:

```
mailjet.transactionnal.client:
    class: "%mailjet.client.class%"
    arguments:
        - "%mailjet.api_key%"
        - "%mailjet.secret_key%"
        - %mailjet.transactionnal.call%
        - %mailjet.transactionnal.options%

swiftmailer.transport.eventdispatcher.mailjet:
    class: Swift_Events_SimpleEventDispatcher

swiftmailer.mailer.transport.mailjet:
    class: Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport
    arguments:
        - "@swiftmailer.transport.eventdispatcher.mailjet"
        - "%mailjet.api_key%"
        - "%mailjet.secret_key%"
        - %mailjet.transactionnal.call%
        - %mailjet.transactionnal.options%
    calls:
        - method: setExternalMailjetClient
          arguments:
              - '@mailjet.transactionnal.client'
```

Mailjet references
------------------

[](#mailjet-references)

- [Mailjet PHP Wrapper](https://github.com/mailjet/mailjet-apiv3-php)
- [Mailjet documentation v3: send transactional email](https://dev.mailjet.com/guides/#send-transactional-email)
- [Mailjet documentation v3.1: send transactional email](https://dev.mailjet.com/beta/#send-transactional-email)

Execute Tests
-------------

[](#execute-tests)

```
vendor/bin/phpunit -c .
```

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

[](#contributing)

If you want to contribute to this project, look at [over here](CONTRIBUTING.md)

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 84.4% 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 ~92 days

Recently: every ~179 days

Total

9

Last Release

2525d ago

Major Versions

1.0.6 → 2.0.02019-06-13

PHP version history (2 changes)1.0-beta.2PHP &gt;=5.4

2.0.0PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/860b87c56fb71609580e16a19de8d764f63601a86d894f5f18cdf8c40c0fbf55?d=identicon)[Nightbr](/maintainers/Nightbr)

---

Top Contributors

[![Nightbr](https://avatars.githubusercontent.com/u/4228646?v=4)](https://github.com/Nightbr "Nightbr (38 commits)")[![mskochev](https://avatars.githubusercontent.com/u/23452885?v=4)](https://github.com/mskochev "mskochev (5 commits)")[![ksaveras](https://avatars.githubusercontent.com/u/485111?v=4)](https://github.com/ksaveras "ksaveras (1 commits)")[![muldos](https://avatars.githubusercontent.com/u/849186?v=4)](https://github.com/muldos "muldos (1 commits)")

---

Tags

mailjetmailjet-apipackagistphpswiftmailerswiftmailer-transportsymfonyMailjetswiftmailer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/welp-mailjet-swiftmailer/health.svg)

```
[![Health](https://phpackages.com/badges/welp-mailjet-swiftmailer/health.svg)](https://phpackages.com/packages/welp-mailjet-swiftmailer)
```

###  Alternatives

[mailjet/mailjet-swiftmailer

A SwiftMailer transport implementation for Mailjet

261.2M9](/packages/mailjet-mailjet-swiftmailer)[cspoo/swiftmailer-mailgun-bundle

Swiftmailer Mailgun bundle

1031.1M](/packages/cspoo-swiftmailer-mailgun-bundle)[aimeos/ai-swiftmailer

SwiftMailer adapter for Aimeos web shops and e-commerce solutions

20168.3k5](/packages/aimeos-ai-swiftmailer)[yuan1994/tp-mailer

A powerful and beautiful php mailer for All of ThinkPHP and Other PHP Frameworks based SwiftMailer

812.0k1](/packages/yuan1994-tp-mailer)[goetas/to-swift-mime-parser

Parse a generic mail stream, and convert it to a SwiftMailer Message

1244.4k2](/packages/goetas-to-swift-mime-parser)[andrewdyer/slim3-mailer

Email support for the Slim Framework using Twig and Swift Mailer.

1032.7k](/packages/andrewdyer-slim3-mailer)

PHPackages © 2026

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