Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

sylvaindeloux/symfony-mailjet-transport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mailjet Transport for Symfony Mailer Component

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',
    ))
;