biozahard/yii2-mailjet

Mailjet client with supporting v3.1

dev-master 2017-10-24 14:00 UTC

This package is not auto-updated.

Last update: 2024-04-28 00:32:35 UTC


README

Create Mailjet Account

mailjet.com

Install

composer require biozahard/yii2-mailjet

or add it to your composer.json in the require section

"biozahard/yii2-mailjet": "*",

Setup

add/replace this in your config under the components key.

'components' => [
  'mailer' => [
    'class' => 'biozahard\mailjet\Mailer',
    'apikey' => 'yourApiKey',
    'secret' => 'yourSecret',
  ],
],

Example

Yii::$app->mailer->compose('signup', ['user' => $user])
->setTo($user->email)
->setFrom([Yii::$app->params['noReplyMailAddress'] => Yii::$app->name])
->setSubject('Signup success')
->send();

Setup Event Tracking

Write the tracking item to the mailer config.

'components' => [
  'mailer' => [
    'class' => 'biozahard\mailjet\Mailer',
    'apikey' => 'yourApiKey',
    'secret' => 'yourSecret',
    'tracking' => [
      'bounce' => 'http://yoururl.com/tracking?event=bounce',
    ],
  ],
],

To activate this url you must run this command at one time.

Yii::$app->mailer->activateTracking();