yii2-postmark Email wrapper to use postmarkapp service

  1. Requirements
  2. Usage
  3. Changes
  4. Resources

Requirements

This extension needs

Usage

Add the extension to your composer.json

[javascript]

{
    "require": {
        "sweelix/yii2-postmark": "~1.0"
    }
}

Add the extension to your configuration

return [
    //....
    'components' => [
        'mailer' => [
            'class' => 'sweelix\postmark\Mailer',
            'token' => '<your postmark token>',
        ],
    ],
];

Send email as usual

// using postmark templates
Yii::$app->mailer->compose()
     ->setFrom('from@domain.com')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->setTemplateId(12345)
     ->setTemplateModel([
         'firstname' => $form->firstname,
         'lastname' => $form->lastname,
     ->send();

// using regular Yii template
Yii::$app->mailer->compose('contact/html')
     ->setFrom('from@domain.com')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->send();

Changes

  • Fix problem with charset

Resources

0 0
1 follower
0 downloads
Yii Version: 2.0
License: BSD-2-Clause
Category: Mail
Developed by: kiwisoft
Created on: Apr 22, 2016
Last updated: 2 years ago

Related Extensions