- Add mail to a queue for subequent sending
- Send mail from the queue at a specified rate
- View queue status, and all past mail history
This module uses the Swiftmailer library.
Version 0.3.0 2014-02-05
- Add
"samwilson/kohana_mailqueue": "0.3.0"
to yourcomposer.json
- Run
composer update
- Create the database table (this is an idempotent command):
php index.php mailqueue:upgrade
Copy MODPATH/kohana_mailqueue/config/mailqueue.php
to APPPATH/config/mailqueue.php
and edit the values therein.
-
Add to the queue:
$mq = new MailQueue; $mq->add($message);
Messages are explained in the Swiftmailer documentation.
-
View the queue:
Request::factory('mailqueue')->execute();
-
Send pending mail:
php index.php mailqueue:send --count=n
Where n is an integer number of messages to send in this run.
Integration tests can be run in the usual Kohana fashion. From the base application directory, run
./vendor/bin/phpunit --group=mailqueue
These tests require a database connection to be set up in config/database.php
and MailQueue to be installed (see above).