sylvaindeloux/symfony-mailjet-transport

This package is abandoned and no longer maintained. The author suggests using the symfony/mailjet-mailer package instead.

Mailjet transport for Symfony Mailer component.

0.6 2022-05-26 10:58 UTC

This package is auto-updated.

Last update: 2022-05-26 10:59:54 UTC


README

Packagist Packagist Travis build GitHub license

Deprecated repository

Since Mailjet has been added by Symfony team to symfony/mailjet-mailer, this bundle will not evolve.

Installation

Install the bundle:

composer require sylvaindeloux/symfony-mailjet-transport

Add it to config/bundles.php:

<?php

return [
    // ...
    SylvainDeloux\MailjetTransport\MailjetTransportBundle::class => ['all' => true],
];

Now you can use your Mailjet account with Symfony Mailer. You just need to configure the MAILER_DSN environment variable with your credentials:

  • SMTP: mailjet+smtp://<your api key>:<your api secret>@in-v3.mailjet.com
  • API: mailjet+api://<your api key>:<your api secret>@api.mailjet.com?version=3.1

Use Mailjet templates with variables

If you want to use a custom template instead of a Twig HTML / text body, and inject your own variables:

$email = (new \SylvainDeloux\MailjetTransport\Mailer\Email())
    // ...
    ->setTemplateId(<your template id>)
    ->setErrorReportingEmail(<your email address for debugging>) // optional, to get a detailled message if template error occurs
    ->setTemplateErrorDeliver() // optional, if you want the mail to be delivered if template error occurs
    ->setVariables(array(
        'key' => 'value',
    ))
;