2017 © Pedro Peláez
 

yii2-extension yii2-mail-queue

Yii2 mail queue component

image

dimichspb/yii2-mail-queue

Yii2 mail queue component

  • Thursday, March 1, 2018
  • by dimichspb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

yii2-mail-queue

Yii2 Module to put mails into the queue. Module replaces mailer component., (*1)

  1. Installation
composer require dimichspb/yii2-mail-queue
  1. Configuration

add to config files web.php, console.php or main.php for advanced yii2 template, (*2)

'components' => [
    'mailer' => [
        'class' => Mailer::className(),
        'mailerOptions' => [
            'useFileTransport' => true,
        ],
        'useFileTransport' => false,
    ],
    'queue' => [
        'class' => \yii\queue\file\Queue::class,
    ]
],
  1. Usage

Use mailer component in common way, (*3)

$this->app->mailer->compose('example')
    ->setFrom('from@domain.com')
    ->setTo('to@domain.com')
    ->setSubject('Test message subject')
    ->setTextBody('Test message plain body');
    ->send();

This will put your message into MailQueue. To process the queue use common queue run command:, (*4)

yii queue/run

or use yii2 queue listener, (*5)

yii queue/listen
  1. Testing
phpunit
  1. Have fun

The Versions

01/03 2018