mikk150 / yii2-queuemailer
yii2 queue mailer component
Installs: 8 185
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 3
Open Issues: 1
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.13
- yiisoft/yii2-queue: ~2.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-07 17:12:02 UTC
README
Queue mailer for Yii 2 framework
Installation
Either run
php composer.phar require --prefer-dist mikk150/yii2-queuemailer "*"
or add
"mikk150/yii2-queuemailer": "*"
to the require section of your composer.json
file
Usage
configure Yii2 config
'components' => [ 'mailer' => [ 'class' => \mikk150\queuemailer\Mailer::class, 'mailer' => [ 'class' => '<underlying mailer config>', 'messageClass' => '<underlying mailer message class>', ], 'queue' => 'mailer-queue', // in case you need specific queue ], ]
and use just like you are using underlying mailer. Emails are being queued and being sent by worker
To set up yii2 queue, please refer to https://github.com/yiisoft/yii2-queue
Retryable job
You can setup retryable job to make several attemts of mail sending.
'components' => [ 'mailer' => [ 'class' => \mikk150\queuemailer\Mailer::class, 'jobConfig' => [ 'class' => \mikk150\queuemailer\jobs\MailRetryableJob::class, 'attempts' => 10, 'timeToRetry' => 600, // ten minutes ], ], ]