LUYA and Yii Framework integration for mailjet service.
Contains:
- Yii Framework BaseMailer for Transaction E-Mails trough API.
- Interface for Subscription Mail Sync including CLI command for Synchronisation.
- A PHP library to convert MJML content into Mailjet Passport json format.
Install the extension through composer:
composer require luyadev/luya-mailjet
Add to config:
[
'components' => [
'mailjet' => [
'class' => 'luya\mailjet\Client',
'apiKey' => '...',
'apiSecret' => '...',
],
'mailer' => [
'class' => 'luya\mailjet\Mailer',
],
]
]
Send transactional E-Mail:
Yii::$app->mailer->compose()
->setFrom('from@domain.com')
->setTo('to@domain.com')
->setSubject('Message subject')
->setTextBody('Plain text content')
->setHtmlBody('<b>HTML content</b>')
->send();
$mail = $this->app->mailer->compose()
->setFrom('from@domain.com')
->setSubject('Hello!')
->setTemplate(484590)
->setVariables(['lastnbame' => 'Lastname Value'])
->setTo(['to@domain.com'])
->send();