PHPackages                             tormjens/wp-queue-mail - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. tormjens/wp-queue-mail

ActiveWordpress-muplugin[Queues &amp; Workers](/categories/queues)

tormjens/wp-queue-mail
======================

Candidate profiles for OSM Aviation.

0.2(8y ago)8563[1 issues](https://github.com/tormjens/wp-queue-mail/issues)MITPHP

Since Nov 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/tormjens/wp-queue-mail)[ Packagist](https://packagist.org/packages/tormjens/wp-queue-mail)[ Docs](https://osmaviation.io)[ RSS](/packages/tormjens-wp-queue-mail/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)DependenciesVersions (2)Used By (0)

WP Queue Mail
=============

[](#wp-queue-mail)

A plugin to queue WordPress emails. When sending out emails in bulk the action of sending each of them is both time and resource consuming. That's where queues come in. When you add an e-mail to a queue instead of sending it, it is a matter of adding a row to the database, instead of connecting to the server, sending the contents and so on.

Simply enable the plugin and it will automatically hook in to the `wp_mail` function and start queueing emails.

The queue part was taken from the (Mailchimp for WooCommerce plugin)\[\], but was originally written by (A5hleyRich)\[\]

Getting started
---------------

[](#getting-started)

The tables needed for the queue to work can be set up using the following WP CLI command in the root of your project.

```
$ wp queue create-tables

```

The queue
---------

[](#the-queue)

The queue can be processed in two ways.

### Via a WP CLI queue listener

[](#via-a-wp-cli-queue-listener)

This is my favorite as it runs on the CLI and thus is not affected by the memory and timeout limit of PHP.

Start the queue listener by navigation to the root of your project and type:

```
$ wp queue listen
```

To make sure the queue listener is always running you could use something like (Supervisor)\[\].

### Via WP Cron

[](#via-wp-cron)

This works for most websites running WordPress. The queue is simply added to the WP Cron schedule and executed according to it.

Using it for other things than mails
------------------------------------

[](#using-it-for-other-things-than-mails)

The queue is not specifically bound to sending emails. You can create your own jobs and dispatch them via the features of this plugin.

### The job

[](#the-job)

A job must extend the `WP_Job` class and contain a `handle` method. You can use a constructor to give the job the data you need processed.

```
