PHPackages                             crabstudio/email-queue - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. crabstudio/email-queue

ActiveCakephp-plugin[Mail &amp; Notifications](/categories/mail)

crabstudio/email-queue
======================

EmailQueue plugin for CakePHP 3.x

1.0.6(9y ago)0342MITPHPPHP &gt;=5.4.16

Since Apr 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ctlabvn/emailqueue)[ Packagist](https://packagist.org/packages/crabstudio/email-queue)[ Docs](https://github.com/crabstudio/emailqueue)[ RSS](/packages/crabstudio-email-queue/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (2)Versions (8)Used By (0)

[![Build Status](https://camo.githubusercontent.com/9e6e2a6132e64dd19d77768b6922103762e8aaff1fe1675eafa79c95891adf83/68747470733a2f2f7472617669732d63692e6f72672f6372616273747564696f2f656d61696c71756575652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/crabstudio/emailqueue) [![Latest Stable Version](https://camo.githubusercontent.com/94da687bbb9e1b87aa3608079a5089f9e33572420f06c29a4dd67a1f305f630e/68747470733a2f2f706f7365722e707567782e6f72672f6372616273747564696f2f656d61696c2d71756575652f762f737461626c65)](https://packagist.org/packages/crabstudio/email-queue) [![Total Downloads](https://camo.githubusercontent.com/4c2a5670f337d722f44a7c087b8552b8cd242e04f4db4c27ae08d97534c78472/68747470733a2f2f706f7365722e707567782e6f72672f6372616273747564696f2f656d61696c2d71756575652f646f776e6c6f616473)](https://packagist.org/packages/crabstudio/email-queue) [![Latest Unstable Version](https://camo.githubusercontent.com/d4898438f5ce4a0e1bae8f3c202ced216d3cfe11a9db00f084622e8298001c58/68747470733a2f2f706f7365722e707567782e6f72672f6372616273747564696f2f656d61696c2d71756575652f762f756e737461626c65)](https://packagist.org/packages/crabstudio/email-queue) [![License](https://camo.githubusercontent.com/b1767f9dc604ba9e9af92445d33572c8bcbd61692be2ef533ca3413b46a62c31/68747470733a2f2f706f7365722e707567782e6f72672f6372616273747564696f2f656d61696c2d71756575652f6c6963656e7365)](https://packagist.org/packages/crabstudio/email-queue)

EmailQueue plugin for CakePHP 3
===============================

[](#emailqueue-plugin-for-cakephp-3)

Note
----

[](#note)

This plugin base on [Lorenzo cakephp-email-queue](https://github.com/lorenzo/cakephp-email-queue) but with little bit different:

```
- Sent to `one|multiple` people
- CC to `none|one|multiple` people
- BCC to `none|one|multiple` people
- Included helpers `Html, Text, Number`

```

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

### The recommended way to install composer packages is:

[](#the-recommended-way-to-install-composer-packages-is)

```
composer require crabstudio/email-queue

```

### Then load this plugin by type in your command line:

[](#then-load-this-plugin-by-type-in-your-command-line)

```
bin/cake plugin load EmailEnqueue --bootstrap

```

or paste this line to the end of `config/bootstrap.php`

```
Plugin::load('EmailQueue', ['bootstrap' => true]);

```

Create required table
---------------------

[](#create-required-table)

2 way to do it

### Use Migration tool

[](#use-migration-tool)

```
bin/cake migrations migrate --plugin EmailQueue

```

### Load sql file into your database

[](#load-sql-file-into-your-database)

```
sql file located at: config/schema/email_queue.sql

```

Usage
-----

[](#usage)

### Call `enqueue` function anywhere you want to store new email in the queue.

[](#call-enqueue-function-anywhere-you-want-to-store-new-email-in-the-queue)

```
/**
 * Stores a new email message in the queue.
 *
 * @param mixed|array $to           email or array of emails as recipients
 * @param array $data    associative array of variables to be passed to the email template
 * @param array $options list of options for email sending.
 *
 * $options Possible keys:
 * - subject : Email's subject
 * - send_at : date time sting representing the time this email should be sent at (in UTC)
 * - template :  the name of the element to use as template for the email message
 * - layout : the name of the layout to be used to wrap email message
 * - format: Type of template to use (html, text or both)
 * - config : the name of the email config to be used for sending
 * @param null|mixed|array $cc           null or email or array of emails as cc
 * @param null|mixed|array $bcc          null or email or array of emails as bcc
 * @param null|mixed|array $reply_to     null or email or array of emails as reply_to
 *
 * @return bool
 */
enqueue($to, array $data, array $options = [], $cc = null, $bcc = null, $reply_to = null)

```

Example

```
// In src/PostsController.php

public function send_email($id) {
	$post = $this->Posts->get($id);
	$result = enqueue(
		'customer@crabstudio.info',
		[
			'post' => $post,
			'request' => $this->request
		],
		[
			'subject' => __('New post notification'),
			'format' => 'html',
			'template' => 'Post/new_post_notification',  //template located here src/Template/Email/html/Post/new_post_notification.ctp
			'layout' => 'notification' //layout located here src/Template/Layout/Email/html/notification.ctp
			'config' => 'default',

		],
		'cc_to_me@crabstudio.info',
		'bcc_to_you@crabstudio.info',
		'reply_to_support@crabstudio.info'
	);
	if ($result) {
		$this->Flash->success(__('Enqueue email ok'));
	} else {
		$this->Flash->error(__('Enqueue email not ok'));
	}
}

```

### Schedule task

[](#schedule-task)

#### Linux:

[](#linux)

Open `crontab` then setup cronjob like this:

```
*       *       *       *       *       cd /var/www/your_project && bin/cake EmailQueue.sender

```

#### Windows:

[](#windows)

Open `Task Scheduler` then follow [this tutorial](http://www.digitalcitizen.life/how-create-task-basic-task-wizard)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Recently: every ~77 days

Total

7

Last Release

3416d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3163410?v=4)[Tuan Nguyen](/maintainers/anhtuank7c)[@anhtuank7c](https://github.com/anhtuank7c)

---

Top Contributors

[![anhtuank7c](https://avatars.githubusercontent.com/u/3163410?v=4)](https://github.com/anhtuank7c "anhtuank7c (5 commits)")

---

Tags

emailcakephpcrabstudioanhtuank7ccakephp 3bulk-email

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/crabstudio-email-queue/health.svg)

```
[![Health](https://phpackages.com/badges/crabstudio-email-queue/health.svg)](https://phpackages.com/packages/crabstudio-email-queue)
```

###  Alternatives

[cakephp/bake

Bake plugin for CakePHP

11212.0M192](/packages/cakephp-bake)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1902.3M40](/packages/dereuromark-cakephp-ide-helper)[narendravaghela/cakephp-mailgun

Mailgun plugin for CakePHP - Send emails using Mailgun API

23364.0k](/packages/narendravaghela-cakephp-mailgun)[lorenzo/cakephp-email-queue

Queue, preview and and send emails stored in the database

57122.3k3](/packages/lorenzo-cakephp-email-queue)[dereuromark/cakephp-setup

A CakePHP plugin containing lots of useful management tools

36199.6k2](/packages/dereuromark-cakephp-setup)[crabstudio/recaptcha

Easily use Google Recaptcha in CakePHP projects

20114.8k1](/packages/crabstudio-recaptcha)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
