Download the PHP package cwbit/cakephp-emailqueue without Composer

On this page you can find all versions of the php package cwbit/cakephp-emailqueue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cakephp-emailqueue

CakePHP 3 - EmailQueue Plugin

This is a plugin for CakePHP 3 that let's you quickly Queue emails to be sent whenever a process function is called.

Supports Mustache templating and Markdown by default.

WHY?

It's not cool to bomb or hold up an order because you can't send an email confirmation. Better to queue the emails and process them in a batch later on, no?

Install

Use Composer (sorry if you're not sure what that is yet - go learn, it's a world-changer)

Load the plugin

Then configure your App to actually load this plugin

Database Installation

Run the following migration command from inside your app directory to build the database for this plugin

Adjust Configure settings

Copy emailqueue.sample.php to emailqueue.php and change any settings you need. This is where you can set up default mail settings like sender and replyTo or even what transport layer you want to use as default.

If you need specific emails to send to specific people or through a specific transport layer then just make sure to set those in your EmailTemplate record in the database.

Set up your Mail Templates

In your Database, set up some EmailTemplates, one for each type of email you want to send.

The columns in this table are modeled after the Email::profile() and pretty much anything that profile accepts can be set in the record.

You'll want one of these for each of the email types you want to send out; e.g. if you have a password-reset email just create a EmailTemplate where email_type = password-reset.

message_html and message_text are TEXT fields where you can specify the body of the email for both the html and text messages respectively.

The default provider(s) in Configure::('EmailQueue.default.provider') allow for both Mustache templating and Markdown parsing. You can make your own providers if needed and just set them in your EmailTemplate

Plugin Usage

Actually sending email with EmailQueue is a simple two-step process

  1. Set up the Template
  2. Queue the email
  3. Process the email queue (CRON)

Set up the Template

Templates in this version of the plugin can fully support both Mustache and Markdown and are processed in that order (by default) - so Mustache variables are expanded first, and then the whole thing is parsed into HTML thru Markdown.

To set up a template, add a record for the email_type (e.g. order-confirmation) in the database, set some basic meta info like subject and add a message_text and message_html block.

If you take a look in the EmailQueue\config\Seeds\EmailTemplatesSeed.php you can see an example of a contact email.

The view_vars can either be passed in when Queuing the email, or set by default in the EmailTemplate or both. They are passed to the email processors in exactly the same way that view variables are passed to the view file from a controller, and so will be accessible by name in Mustache's {{varName}} format (if you're using the default processor).

Ok, let's look at an actual email template example for something like email_type = order-confirmation.

If we assume that $order is a entity with order details that we've passed in when Queuing the email (see next section), then we can set view_vars to array('order'=>$order) and then in our template record set message_html and/or message_text to something like this

Which, when sent, would get parsed out into the following (using default processors)

Queue an Email

Add the EmailQueue component to your controller

And then to actually Queue an email, just specify the email type, who it's to, and any viewVars the Template (set in the config EmailQueue.specific.{$type}) will need when rendering itself.

Sending Queued Emails

Manually run, or add to CRON, the following commandline command

The shell has the following options:

All the options can be chained together.

CLI Examples

To send all pending emails, run the following

To explicitly send all pending emails, run the following

To send all emails of type order-confirmation, run the following

To send up to 100 emails at once, run the following

To send a specific email, run the following

To send up to 100, failed, user-resetpw emails, run the following


All versions of cakephp-emailqueue with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
cakephp/cakephp Version ~3.0
cakephp/plugin-installer Version *
cakephp/migrations Version ~1.0
cwbit/cakephp-markdown Version ~1.0
mustache/mustache Version ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cwbit/cakephp-emailqueue contains the following files

Loading the files please wait ....