samwilson / kohana_mailqueue
Kohana module to queue, send, and log email messages from an application.
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 4
Forks: 2
Open Issues: 0
Type:kohana-module
Requires
- php: >=5.3.3
- composer/installers: ~1.0
- kohana/core: ~3.3.0
- kohana/database: ~3.3.0
- kohana/minion: ~3.3.0
- swiftmailer/swiftmailer: ~5.0
Requires (Dev)
- phpunit/phpunit: ~3.0
README
- 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
Installation
- 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
Configuration
Copy MODPATH/kohana_mailqueue/config/mailqueue.php
to APPPATH/config/mailqueue.php
and edit the values therein.
Usage
-
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.
Testing
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).