Mail Queue
Mail Queue
Description
This plugin enhances the security and stability of your WordPress installation by delaying and controlling wp_mail() email submissions through a managed queue.
If your site exhibits unusual behavior — such as a spam bot repeatedly submitting forms — you will be alerted immediately.
- Intercepts wp_mail() and places outgoing messages in a queue
- Configure how many emails are sent and at what interval
- Log all queued email submissions
- Receive alerts when the queue grows unexpectedly
- Receive alerts when WordPress is unable to send emails
Installation
Upload the the plugin, activate it, and go to the Settings to enable the Queue.
Please make sure that your WP Cron is running reliably.
Faq
Yes. Once activated please go into the Settings of the Plugin to do some configurations.
You can enable the Queue, control how many emails and how often they should be sent.
You can enable the Alerting feature and control at which point exactly you want to be alerted.
When enabled, the plugin intercepts wp_mail(). Instead of sending emails immediately, they are stored in the database and released gradually via WP-Cron according to your configured interval.
No. This plugin does not change HOW the emails are sent. For example: If you use SMTP for sending, or a third-party-service like Mailgun, everything will still work.
This plugin changes WHEN the emails are sent. By the email Queue it gives you control about how many emails should be sent in which interval.
If you’re using a caching plugin like W3 Total Cache, WP Rocket or any other caching solution which generates static HTML files and serves them to visitors, you’ll have to make sure you’re calling the wp-cron file manually every couple of minutes.
Otherwise your normal WP Cron wouldn’t be called as often as it should be and scheduled messages would be sent with big delays.
Same situation here. Please make sure you’re calling the WordPress Cron by an external service or your webhoster every couple of minutes.
You are covered. All attachments are stored temporarily in the queue until they are sent along with their corresponding emails.
This is a simple and effective way to improve the security of your WordPress installation.
Imagine: In case your website is sending spam through wp_mail(), the email Queue would fill up very quickly preventing your website from sending so many spam emails at once. This gives you time and avoids a lot of trouble.
Queue Alerts warn you, if the Queue is longer than usal. You decide at which point you want to be alerted. So you get the chance to have a look if there might be something wrong on the website.
Yes, you can add the custom X-Mail-Queue-Prio header set to High to your email. High priority emails will be sent through the standard Mail Queue sending cycle but before all normal emails lacking a priority header in the queue.
Example 1 (add priority to Woocommerce emails):
add_filter('woocommerce_mail_callback_params',function ( $array ) {
$prio_header = 'X-Mail-Queue-Prio: High';
if (is_array($array[3])) {
$array[3][] = $prio_header;
} else {
$array[3] .= $array[3] ? "\r\n" : '';
$array[3] .= $prio_header;
}
return $array;
},10,1);
Example 2 (add priority to Contact Form 7 form emails):
When editing a form in Contact Form 7 just add an additional line to the
Additional Headers field under the Mail tab panel.
X-Mail-Queue-Prio: High
Example 3 (add priority to WordPress reset password emails):
add_filter('retrieve_password_notification_email', function ($defaults, $key, $user_login, $user_data) {
$prio_header = 'X-Mail-Queue-Prio: High';
if (is_array($defaults['headers'])) {
$defaults['headers'][] = $prio_header;
} else {
$defaults['headers'] .= $defaults['headers'] ? "\r\n" : '';
$defaults['headers'] .= $prio_header;
}
return $defaults;
}, 10, 4);
Yes, this is possible (if you absolutely need to do this).
For this you can add the custom X-Mail-Queue-Prio header set to Instant to your email. These emails are sent instantly circumventing the mail queue. They still appear in the Mail Queue log flagged as instant.
Mind that this is a potential security risk and should be considered carefully. Please use only as an exception.
Example 1 (instantly send Woocommerce emails):
add_filter('woocommerce_mail_callback_params',function ( $array ) {
$prio_header = 'X-Mail-Queue-Prio: Instant';
if (is_array($array[3])) {
$array[3][] = $prio_header;
} else {
$array[3] .= $array[3] ? "\r\n" : '';
$array[3] .= $prio_header;
}
return $array;
},10,1);
Example 2 (instantly send Contact Form 7 form emails):
When editing a form in Contact Form 7 just add an additional line to the
Additional Headers field under the Mail tab panel.
X-Mail-Queue-Prio: Instant
Example 3 (instantly send WordPress reset password emails):
add_filter('retrieve_password_notification_email', function ($defaults, $key, $user_login, $user_data) {
$prio_header = 'X-Mail-Queue-Prio: Instant';
if (is_array($defaults['headers'])) {
$defaults['headers'][] = $prio_header;
} else {
$defaults['headers'] .= $defaults['headers'] ? "\r\n" : '';
$defaults['headers'] .= $prio_header;
}
return $defaults;
}, 10, 4);
Yes, the wp_mail() function works as expected.
When calling wp_mail() the function returns true as expected. This means the email has been entered into the queue.
Exceptions:
If for some reason the email cannot be entered into the database, wp_mail() will return false.
However if you send an email using the instant header option the email will be considered important.
In this case the email will be sent right away, even if there is an error creating a log for it in the queue.
Yes, but with limitations.
Do not activate the Mail Queue for the whole network. Instead, please activate it for each site separately. Then it will work smoothly. In a future release we’ll add full MultiSite support.
Reviews
Works as a charm 👌
By chickenme (pitlamgi) on August 29, 2024
This plugin is a must have in all my clients' websites, speed up SMTP email flow. It deserves 5 stars⭐⭐⭐⭐⭐
Thanks team for the plugin. Highly recommend plugin for your websites👌
Good plugin
By kbiegert on August 10, 2024
This is a good plugin. Easy to configure and use. Good support.
Good
By SONBEAT (sonbeat21) on July 12, 2024
Easy to use.
does what it claims. great support
By shagadelic on December 7, 2023
simple, straight-up, does what it claims. great support.
Good
By chelminski on July 8, 2023
I recommend
Changelog
1.4.6
- Added support for the
pre_wp_mailhook
1.4.5
- Check for incompatible plugins
- Minor bug fixes
1.4.4
- Performance improvements for large emails
1.4.3
- Updated bulk actions for log and queue lists
1.4.2
- Database improvements
1.4.1
- Refine detection for html when previewing emails
- Catch html parse errors when previewing emails
1.4
- Added support for previewing HTML emails as plain text
- Improved preview for HTML emails
- Minor bug fixes
1.3.1
- Added support for the following
wp_mailhooks:wp_mail_content_type,wp_mail_charset,wp_mail_from,wp_mail_from_name - Minor bug fixes
1.3
- Refactor to use WordPress Core functionality
- Added option to set the interval for sending emails in minutes or seconds
- Added feature to send emails with high priority on top of the queue
- Added feature to send emails instantly without delay bypassing the queue
1.2
- Performance and security improvements
1.1
- Resend emails
- Notification if WordPress can’t send emails
1.0
- Initial release.



