PHPackages                             dekalee/mailjet-bundle - 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. dekalee/mailjet-bundle

ActiveSymfony-bundle[Mail &amp; Notifications](/categories/mail)

dekalee/mailjet-bundle
======================

This bundle provides a transport for swiftmailer to send mail through mailjet

v2.1.0(7y ago)257.4k[1 PRs](https://github.com/dekalee/mailjet-bundle/pulls)MITPHP &gt;=5.5

Since Jun 10Compare

[ Source](https://github.com/dekalee/mailjet-bundle)[ Packagist](https://packagist.org/packages/dekalee/mailjet-bundle)[ RSS](/packages/dekalee-mailjet-bundle/feed)WikiDiscussions Synced today

READMEChangelogDependencies (5)Versions (18)Used By (0)

Mailjet Bundle
==============

[](#mailjet-bundle)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c7cf85d14709c4918e818f2df7d682e4affe9125e22be4118a350023840d3a87/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656b616c65652f6d61696c6a65742d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dekalee/mailjet-bundle/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/e762844073428e17a9652db6fd8525582727774ba96e6343837c6ed7a6e12fc4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64656b616c65652f6d61696c6a65742d62756e646c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dekalee/mailjet-bundle/?branch=master)[![Build Status](https://camo.githubusercontent.com/5ae8872ed61dc87c62fbd4916e2014d660f44c7bd894d69ecc5ad51f073e941d/68747470733a2f2f7472617669732d63692e6f72672f64656b616c65652f6d61696c6a65742d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dekalee/mailjet-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/109ba80527af448ddbd17da9690ab3c3412b284b880ca46325cf89e166246d9b/68747470733a2f2f706f7365722e707567782e6f72672f64656b616c65652f6d61696c6a65742d62756e646c652f762f737461626c65)](https://packagist.org/packages/dekalee/mailjet-bundle)[![Total Downloads](https://camo.githubusercontent.com/d4cdda18a7e77a2c5f848147516b5376eaece6054b181de009e78ed3389366d0/68747470733a2f2f706f7365722e707567782e6f72672f64656b616c65652f6d61696c6a65742d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/dekalee/mailjet-bundle)[![License](https://camo.githubusercontent.com/1bbddfdac27111b92b78791190b37c844f67146d32e3e889b626959cacf6d276/68747470733a2f2f706f7365722e707567782e6f72672f64656b616c65652f6d61696c6a65742d62756e646c652f6c6963656e7365)](https://packagist.org/packages/dekalee/mailjet-bundle)

Usage
-----

[](#usage)

This bundle provides a transport element to use `SwiftMailer` from the `Symfony` project to send mail using `Mailjet`.

Configuration
-------------

[](#configuration)

To configure the bundle, you will have to enter the api key, secret and default template id :

```
    # app/config/config.yml
    dekalee_mailjet:
        api_key: %api_key%
        secret_key: %secret_key%
        base_template_id: %base_template_id%
```

You will also have to modify the transport in the mailer configuration :

```
    # app/config/config.yml
    swiftmailer:
        transport:  mailjet
```

Extension
---------

[](#extension)

In mailjet, you can define your own template for the mail you send. It is possible to use different template for each mail you will send.

To perform this action, you will need to guess the template Id from the message being send.

### Create a guesser

[](#create-a-guesser)

You should implement the class : `Dekalee\MailjetBundle\Guesser\TemplateIdGuesserInterface`

There are two methods inside :

- supports, which will decide if your strategy is able to give the template Id for this message
- guess, which will return the template Id for the given message

### Declare the service

[](#declare-the-service)

Once your class is created, you should add the tag `dekalee_mailjet.guesser.template_id.strategy`to your service definition

Campaign management
-------------------

[](#campaign-management)

### Affiliate a user to a campaign

[](#affiliate-a-user-to-a-campaign)

To affiliate a contact to a campaign, you should use the `ContactListSubscriber` class, declared under the `dekalee_mailet.subscriber.contact_list` key in the container:

```
    class RegisterUser
    {
        protected $subscriber;

        public function __construct(ContactListSubscriber $subscriber)
        {
            $this->subscriber = $subscriber;
        }

        public function addUser(User $user)
        {
            $this->subscriber->subscribe(
                'campaignName',
                $user->getEmail(),
                [
                    'subject' => 'Mail subject (linked to the user)',
                    'content' => 'Mail content (linked to the user)',
                ]
            );
        }
    }
```

The template used for sending personnal emails to the contact from this list would be able to use the variable `content_CampaignName` and `subject_CampaignName`.

### Unsubscribe a user from a campaign

[](#unsubscribe-a-user-from-a-campaign)

To affiliate a contact to a campaign, you should use the `ContactListUnSubscriber` class, declared under the `dekalee_mailet.unsubscriber.contact_list` key in the container:

```
    class UnRegisterUser
    {
        protected $unsubscriber;

        public function __construct(ContactListUnsubscriber $unsubscriber)
        {
            $this->unsubscriber = $unsubscriber;
        }

        public function delUser(User $user)
        {
            $this->unsubscriber->unsubscribe('campaignName', $user->getEmail());
        }
    }
```

Custom template
---------------

[](#custom-template)

If you want to use a custom template from mailjet with some custom variables, there is a way to do it in the bundle:

- Create a custom message

```
    namespace Bar;

    use Dekalee\MailjetBundle\Message\SwiftCustomVarsMessage;

    class FooMessage extends SwiftCustomVarsMessage {}
```

- Fill the vars property with the parameters you want to send

```
    $message = new FooMessage();

    $message->setVars(['bar' => 'baz']);
```

- Configure the simple message guesser to use your template

```
    dekalee_mailjet:
        simple_template_choice:
            Bar\FooMessage: 1
```

If you send the mail throught mailjet, the template 1 will be used.

In your working environment, you will receive a mail with all the vars json encoded.

Debug
-----

[](#debug)

Since version 2.1.0, it is possible to use mailjet debug capabilities.

You can directly configure them in the config file:

```
    dekalee_mailjet:
        reporting_email: foo@bar.com
        force_deliver: true
```

The `reporting_email` parameter will be used to send the error report mail.

The `force_deliver` parameter will force the mail deliver even if there is a syntax issue.

Limitation
----------

[](#limitation)

For the moment, the bundle does not supports the inline attachement functionnality from mailjet, but contributions are welcome :).

Warning for symfony4
--------------------

[](#warning-for-symfony4)

When used with env parameters, the swiftmailer bundle automatically generates the transport by using a factory. To avoid this workflow, you shall not use env parameters to configure your swiftmailer installation.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 82% 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 ~57 days

Recently: every ~12 days

Total

16

Last Release

2812d ago

Major Versions

v0.5.4 → v1.0.02018-08-29

v1.0.0 → v2.0.02018-08-29

v1.0.1 → v2.1.02018-10-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2675545?v=4)[Nicolas Thal](/maintainers/nicolasThal)[@nicolasThal](https://github.com/nicolasThal)

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

![](https://www.gravatar.com/avatar/81e74183a746c1d0813128bea90894477d621a72a1290bc540c225728f70109e?d=identicon)[victorbalssa](/maintainers/victorbalssa)

![](https://avatars.githubusercontent.com/u/1492645?v=4)[Jérémy GIGNON](/maintainers/gignonje)[@gignonje](https://github.com/gignonje)

![](https://www.gravatar.com/avatar/bce05fefcead2a9f1fadaa947173566615109994b6abfc58e1b28ea92d0f551f?d=identicon)[gbd\_dkl](/maintainers/gbd_dkl)

![](https://avatars.githubusercontent.com/u/23316288?v=4)[julienguilmont](/maintainers/julienguilmont)[@julienguilmont](https://github.com/julienguilmont)

---

Top Contributors

[![nicolasThal](https://avatars.githubusercontent.com/u/2675545?v=4)](https://github.com/nicolasThal "nicolasThal (50 commits)")[![victorbalssa](https://avatars.githubusercontent.com/u/12813321?v=4)](https://github.com/victorbalssa "victorbalssa (7 commits)")[![sempixel](https://avatars.githubusercontent.com/u/1658628?v=4)](https://github.com/sempixel "sempixel (2 commits)")[![yoye](https://avatars.githubusercontent.com/u/570307?v=4)](https://github.com/yoye "yoye (2 commits)")

### Embed Badge

![Health badge](/badges/dekalee-mailjet-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[api-platform/doctrine-orm

Doctrine ORM bridge

293.9M78](/packages/api-platform-doctrine-orm)[terminal42/notification_center

Notification Center extension for Contao Open Source CMS

67407.8k91](/packages/terminal42-notification-center)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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