vs-point / symfony-mailjet-mailer
Symfony Mailjet Mailer Bridge
Installs: 39
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bridge
Requires
- php: >=7.1.3
- mailjet/mailjet-apiv3-php: ^1.4
- symfony/mailer: ^4.4.10
Requires (Dev)
- symfony/http-client: ^4.3
README
Provides Mailjet integration for Symfony Mailer.
Usage
- Installation via composer
composer require vs-point/symfony-mailjet-mailer
- Register in services.yaml
VSPoint\Mailjet\Transport\MailjetTransportFactory: tags: - mailer.transport_factory
- Provide configuration in .env file
{JETMAILER_NAME}=mailjet://{public key}:{private key}@api.mailjet.com
Send base email
$dsn = 'mailjet://{public key}:{private key}@api.mailjet.com'; $transport = Transport::fromDsn($dsn); $mailer = new Mailer($transport); $email = (new Email()) ->from('hello@example.com') ->to('you@example.com') //->cc('cc@example.com') //->bcc('bcc@example.com') //->replyTo('fabien@example.com') //->priority(Email::PRIORITY_HIGH) ->subject('Time for Symfony Mailer!') ->text('Sending emails is fun again!') ->html('<p>See Twig integration for better HTML integration!</p>'); $mailer->send($email);
Send templated email
$dsn = 'mailjet://{public key}:{private key}@api.mailjet.com'; $transport = Transport::fromDsn($dsn); $mailer = new Mailer($transport); $email = (new MailjetTemplateEmail(123456789,['variable'=>'value'])) ->from('my@mail.com'); $mailer->send($email);