sylvaindeloux / symfony-mailjet-transport
Mailjet transport for Symfony Mailer component.
Installs: 5 377
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 1
Type:symfony-bundle
Requires
- php: ^7.1||^8.0
- symfony/http-client: ^4.4||^5.0||^6.0
- symfony/mailer: ^4.4||^5.0||^6.0
Requires (Dev)
README
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',
))
;