2017 © Pedro Peláez
 

library yii2-mailjet

Mailjet client

image

weluse/yii2-mailjet

Mailjet client

  • Tuesday, August 15, 2017
  • by Weluse
  • Repository
  • 4 Watchers
  • 6 Stars
  • 838 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 9 Versions
  • 5 % Grown

The README.md

Mailjet Client

Create Mailjet Account

https://goo.gl/YNWTwd, (*1)

Install

composer require weluse/yii2-mailjet

or add it to your composer.json in the require section, (*2)

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

Setup

add/replace this in your config under the components key., (*3)

'components' => [
  'mailer' => [
    'class' => 'weluse\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();

Attachment example

// Mail with attachment from string via Message::attachContent()
Yii::$app->mailer->compose('view-name')
->setSubject('Mail with attachment from content')
->attachContent("This is the attachment content", ['fileName' => 'attachment.txt', 'contentType' => 'text/plain'])
->setTo('info@example.com')
->send();

// Mail with attachment from file via Message::attach()
$filePath = ... // a file path here;
Yii::$app->mailer->compose('view-name')
->setSubject('Mail with attachment from content')
->attach($filePath)
->setTo('info@example.com')
->send();

Setup Event Tracking

Write the tracking item to the mailer config., (*4)

'components' => [
  'mailer' => [
    'class' => 'weluse\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., (*5)

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

The Versions

15/08 2017

dev-master

9999999-dev

Mailjet client

  Sources   Download

MIT

The Requires

 

15/08 2017

v0.1.4

0.1.4.0

Mailjet client

  Sources   Download

MIT

The Requires

 

15/08 2017

dev-develop

dev-develop

Mailjet client

  Sources   Download

MIT

The Requires

 

12/06 2017

v0.1.3

0.1.3.0

Mailjet client

  Sources   Download

MIT

The Requires

 

30/04 2017

v0.1.2

0.1.2.0

Mailjet client

  Sources   Download

MIT

The Requires

 

23/02 2017

dev-feature/bcc-and-cc

dev-feature/bcc-and-cc

Mailjet client

  Sources   Download

MIT

The Requires

 

30/09 2016

v0.1.1

0.1.1.0

Mailjet client

  Sources   Download

MIT

The Requires

 

29/09 2016

dev-patch-1

dev-patch-1

Mailjet client

  Sources   Download

MIT

The Requires

 

15/09 2016

v0.1.0

0.1.0.0

Mailjet client

  Sources   Download

MIT

The Requires