1. Go to this page and download the library: Download cbm/yii2-mailqueue library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cbm / yii2-mailqueue example snippets
return [
//....
'components' => [
// This is the message queue mailer config, it substitutes the original mailer config
'mailer' => [
'class' => 'cbm\mailqueue\QueueMailer',
'mqMessageClass' => 'cbm\mailqueue\RabbitMessage',
'mqConfig' => [
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'queue' => 'email_task',
'publishRoutingKey' => 'email_task',
],
],
// You also need the original yii swift mailer but with a different name
'emailMailer' => [
'class' => 'yii\swiftmailer\Mailer',
//....
],
],
];