Giter Site home page Giter Site logo

monzinsof / cakephp-mailqueue-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hakito/cakephp-mailqueue-plugin

0.0 1.0 0.0 198 KB

Plugin to store mail in a queue for later sendout

License: GNU General Public License v2.0

PHP 100.00%

cakephp-mailqueue-plugin's Introduction

Latest Stable Version Total Downloads Latest Unstable Version License

CakePHP-Mailqueue-Plugin

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

If you are using composer simply add the following requirement to your composer file:

"hakito/cakephp-mailqueue-plugin": ">=1.2"

Otherwise download the plugin to app/Plugin/Mailqueue.

Simply load the plugin in your bootstrap:

CakePlugin::load('Mailqueue');

Configuration

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

class EmailConfig
{
    public $queue = array(
        // required:
        'transport' => 'Mailqueue.Queue',
        'from' => '[email protected]',

        // optional:
        'queueFolder' => '/tmp/mailqueue', // storage location for mailqueue
        'requeue' => array(300, 500, 1000) // requeue after x seconds in case of an error
    );

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

Queue a mail

Send mail to the queue as usually in cake

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:

Console/cake Mailqueue.SendMail queue smtp

Donate

Every donation is welcome

cakephp-mailqueue-plugin's People

Contributors

hakito avatar

Watchers

Moncif AIDI avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.