Skip to content

Commit

Permalink
Add usage instructions to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hakito committed Oct 6, 2013
1 parent bc5ede2 commit af28c4d
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
CakePHP-Mailqueue-Plugin
========================

Plugin to store maile in a queue for later sendout
Plugin to store mail in a queue for later sendout.

When working with emails on a webservice sending email blocks the http request until the email is actually sent out. This can be frustrating for a user especially if the smtp server does not respond promptly.

With this plugin you can save the mail to a local queue file and invoke the actual transport for example with a cron fired cake shell command.

Installation
-------------

Download the plugin to app/Plugin/Mailqueue.

Configuration
-------------

Add a new entry to the app/Config/email.php or replace it with an existing one.

```php
class EmailConfig
{
public $queue = array(
// required:
'transport' => 'Mailqueue.Queue',
'from' => '[email protected]',
// optional:
'queueFolder' => '/tmp/mailqueue' // storage location for mailqueue
);

// Your exiting config
public $smtp = array(...)
}
```

Queue a mail
------------

Send mail to the queue as usually in cake

```php
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('queue');
// place your content in $email
$email->send();
```

Do the real sendout
-------------------

Use cake shell to do the real sendout. The shell script requires 2 arguments. The first is the name of your queue configuration and the second the name of the config to use for the real sendout.

In your app directory execute:

```sh
Console/cake Mailqueue.SendMail queue smtp
```

0 comments on commit af28c4d

Please sign in to comment.