PHP code example of izumi-kun / yii2-spoolmailer

1. Go to this page and download the library: Download izumi-kun/yii2-spoolmailer 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/ */

    

izumi-kun / yii2-spoolmailer example snippets


return [
    //....
    'components' => [
        //....
        'mailer' => [
            'class' => izumi\spoolmailer\Mailer::class,
        ],
    ],
];

return [
    //....
    'controllerMap' => [
        'mail' => izumi\spoolmailer\MailController::class,
    ],
];

Yii::$app->mailer->compose('contact/html')
     ->setFrom('[email protected]')
     ->setTo($form->email)
     ->setSubject($form->subject)
     ->queue();

return [
    //....
    'components' => [
        //....
        'mailer' => [
            'class' => izumi\spoolmailer\Mailer::class,
            'spoolMailer' => [
                'class' => izumi\spoolmailer\spools\QueueSpool::class,
                'queue' => 'queue', // the application component ID of the queue object
            ],
        ],
    ],
];

* * * * * php /var/www/yii-app/yii mail/flush >/dev/null 2>&1