PHPackages                             lorenzo/cakephp-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. lorenzo/cakephp-email-queue

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

lorenzo/cakephp-email-queue
===========================

Queue, preview and and send emails stored in the database

5.1.0(3y ago)57121.5k↓35.3%31[3 issues](https://github.com/lorenzo/cakephp-email-queue/issues)[2 PRs](https://github.com/lorenzo/cakephp-email-queue/pulls)1MITPHP

Since Mar 13Pushed 2y ago7 watchersCompare

[ Source](https://github.com/lorenzo/cakephp-email-queue)[ Packagist](https://packagist.org/packages/lorenzo/cakephp-email-queue)[ Docs](https://github.com/lorenzo/cakephp-email-queue)[ RSS](/packages/lorenzo-cakephp-email-queue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (20)Used By (1)

CakePHP Email Queue plugin
==========================

[](#cakephp-email-queue-plugin)

This plugin provides an interface for creating emails on the fly and store them in a queue to be processed later by an offline worker using a cakephp shell command.

It also contains a handy shell for previewing queued emails, a very handy tool for modifying email templates and watching the result.

Requirements
------------

[](#requirements)

- CakePHP 4.x

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

[](#installation)

```
composer require lorenzo/cakephp-email-queue
```

The plugin uses Debug email transport, so make sure your email config contain it:

```
'EmailTransport' => [
        'Debug' => [
            'className' => 'Debug'
        ],
]

```

### Enable plugin

[](#enable-plugin)

```
bin/cake plugin load EmailQueue
```

### Load required database table

[](#load-required-database-table)

In order to use this plugin, you need to create a database table. Required SQL is located at

```
# config/Schema/email_queue.sql

```

Just load it into your database. You are free to change the file to use an integer primary key instead of UUIDs.

Or run migrations command:

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

```

Usage
-----

[](#usage)

Whenever you need to send an email, use the EmailQueue model to create and queue a new one by storing the correct data:

```
use EmailQueue\EmailQueue;
EmailQueue::enqueue($to, $data, $options);

```

`enqueue` method receives 3 arguments:

- First argument is a string or array of email addresses that will be treated as recipients.
- Second arguments is an array of view variables to be passed to the email template
- Third arguments is an array of options, possible options are

- `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. (maximum supported length is 100 chars)
- `layout`: the name of the layout to be used to wrap email message
- `format`: Type of template to use (html, text or both)
- `headers`: A key-value list of headers to send in the email
- `theme`: The View Theme to find the email templates
- `config`: the name of the email config to be used for sending
- `from_name`: String with from name. Must be supplied together with `from_email`.
- `from_email`: String with from email. Must be supplied together with `from_name`.

### Previewing emails

[](#previewing-emails)

It is possible to preview emails that are still in the queue, this is very handy during development to check if the rendered email looks at it should; no need to queue the email again, just make the changes to the template and run the preview again:

```
# bin/cake EmailQueue.preview

```

### Sending emails

[](#sending-emails)

Emails should be sent using bundled Sender command, use `-h` modifier to read available options

```
# bin/cake EmailQueue.sender -h

```

You can configure this command to be run under a cron or any other tool you wish to use.

Contributing
============

[](#contributing)

Run the tests
-------------

[](#run-the-tests)

```
./vendor/bin/phpunit tests/

```

Check style
-----------

[](#check-style)

```
./vendor/bin/phpcs ./src ./tests/ --standard=vendor/cakephp/cakephp-codesniffer/CakePHP

```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~177 days

Recently: every ~321 days

Total

19

Last Release

1249d ago

Major Versions

1.0.0 → 2.0.02014-07-01

2.0.2 → 3.0.02016-03-17

3.3.1 → 4.0.02020-04-14

4.0.0 → v5.0.02022-04-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b4694a64f9dab01ec0e776946b15c84113dee8a51344f1c394f40bd7a453312?d=identicon)[lorenzo](/maintainers/lorenzo)

---

Top Contributors

[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (43 commits)")[![jippi](https://avatars.githubusercontent.com/u/22841?v=4)](https://github.com/jippi "jippi (19 commits)")[![anhtuank7c](https://avatars.githubusercontent.com/u/3163410?v=4)](https://github.com/anhtuank7c "anhtuank7c (5 commits)")[![AD7six](https://avatars.githubusercontent.com/u/33387?v=4)](https://github.com/AD7six "AD7six (3 commits)")[![zledwon](https://avatars.githubusercontent.com/u/15191082?v=4)](https://github.com/zledwon "zledwon (3 commits)")[![PhantomWatson](https://avatars.githubusercontent.com/u/1965565?v=4)](https://github.com/PhantomWatson "PhantomWatson (2 commits)")[![waspinator](https://avatars.githubusercontent.com/u/100416?v=4)](https://github.com/waspinator "waspinator (2 commits)")[![achepukov](https://avatars.githubusercontent.com/u/780803?v=4)](https://github.com/achepukov "achepukov (1 commits)")[![noglitchyo](https://avatars.githubusercontent.com/u/764791?v=4)](https://github.com/noglitchyo "noglitchyo (1 commits)")[![pabloelcolombiano](https://avatars.githubusercontent.com/u/23249541?v=4)](https://github.com/pabloelcolombiano "pabloelcolombiano (1 commits)")[![parkmira](https://avatars.githubusercontent.com/u/985533?v=4)](https://github.com/parkmira "parkmira (1 commits)")[![saeideng](https://avatars.githubusercontent.com/u/8215801?v=4)](https://github.com/saeideng "saeideng (1 commits)")[![stripthis](https://avatars.githubusercontent.com/u/77410?v=4)](https://github.com/stripthis "stripthis (1 commits)")[![k1LoW](https://avatars.githubusercontent.com/u/57114?v=4)](https://github.com/k1LoW "k1LoW (1 commits)")[![angelxmoreno](https://avatars.githubusercontent.com/u/363479?v=4)](https://github.com/angelxmoreno "angelxmoreno (1 commits)")[![ankr](https://avatars.githubusercontent.com/u/1147674?v=4)](https://github.com/ankr "ankr (1 commits)")[![f0xx16](https://avatars.githubusercontent.com/u/20948296?v=4)](https://github.com/f0xx16 "f0xx16 (1 commits)")[![henrikjuul](https://avatars.githubusercontent.com/u/105289?v=4)](https://github.com/henrikjuul "henrikjuul (1 commits)")[![ishanvyas22](https://avatars.githubusercontent.com/u/17404636?v=4)](https://github.com/ishanvyas22 "ishanvyas22 (1 commits)")[![julianpollmann](https://avatars.githubusercontent.com/u/2836863?v=4)](https://github.com/julianpollmann "julianpollmann (1 commits)")

---

Tags

emailcakephpqueuecronpreview

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[narendravaghela/cakephp-mailgun

Mailgun plugin for CakePHP - Send emails using Mailgun API

23356.6k](/packages/narendravaghela-cakephp-mailgun)[nterms/yii2-mailqueue

Email queue component for yii2 that works with yii2-swiftmailer.

87129.2k2](/packages/nterms-yii2-mailqueue)[gourmet/email

Gourmet Email Plugin for rapid CakePHP application development.

175.2k](/packages/gourmet-email)[tigrov/yii2-mailqueue

Yii2 mail queue component for yii2-swiftmailer.

186.1k](/packages/tigrov-yii2-mailqueue)

PHPackages © 2026

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