close
BERJAYA
BERJAYA

Mail Queue

外掛說明

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 and can optionally pause delivery automatically while you investigate.

  • Intercepts wp_mail() and places outgoing messages in a queue
  • Configure how many emails are sent and at what interval
  • Pause the queue without disabling the plugin completely
  • Log queued emails, sent emails, alerts, and queue events
  • Receive alerts when the queue grows unexpectedly
  • Optionally auto-pause the queue when an alert is triggered
  • Send selected queued emails immediately from the backend
  • Automatically prioritize WordPress password reset emails
  • Receive alerts when WordPress is unable to send emails

螢幕擷圖

  • BERJAYA
  • BERJAYA
  • BERJAYA
  • BERJAYA

安裝方式

Upload the plugin, activate it, and go to the Settings to enable the Queue.

請確保網站的 WP Cron 可如常執行。

常見問題集

是否需要進行任何組態?

Yes. Once activated, please go into the plugin settings and configure the queue for your website.

You can choose whether the Mail Queue should be Enabled, Paused, or Disabled, and you can control how many emails are sent and how often they should be sent.

You can also enable alerts, define the queue size threshold for alerts, and optionally enable automatic pausing when an alert is triggered.

這個外掛如何運作?

When the Mail Queue is 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.

The plugin offers three states:

Enabled: emails are added to the queue and sent gradually by WP-Cron.
Paused: emails are still added to the queue, but no queued emails are sent until you enable the queue again.
Disabled: the plugin does not intercept wp_mail() and has no effect on outgoing emails.

這個外掛是否會變更電子郵件的傳送方式?

不會。這個外掛不會變更電子郵件的傳送方式。舉例來說,如果這個網站使用 SMTP 傳送電子郵件,或是使用 Mailgun 這類外部服務,一切仍會如預期般運作。

這個外掛只會影響電子郵件傳送的時機,它會透過 [佇列] 功能控制在指定時間間隔內要傳送的電子郵件數量。

如果網站安裝了快取外掛,這個外掛是否能正確運作?

如果這個網站正在使用如 W3 Total Cache、WP Rocket 等快取外掛或其他會為網站訪客產生並提供靜態 HTML 檔案的快取解決方案,網站管理員必須每隔幾分鐘便手動呼叫 wp-cron 檔案。

如果不這麼做,便不會定期呼叫 WP Cron,加入排程的訊息,在傳送前會遇到極大的延遲。

使用如 NGINX 的 Proxy 快取會產生任何影響嗎?

開發者也是這種組態。請確認每隔幾分鐘便由外部服務或網站主機呼叫 WordPress Cron。

網站使用的聯絡表單編輯器支援附件,這些附件會如何處理?

這個外掛也支援附件,全部附件在對應的電子郵件寄出前,都會暫時儲存於佇列中。

什麼是佇列通知?

Queue alerts are a simple and effective way to improve the security of your WordPress installation.

Imagine your website starts sending spam through wp_mail(). The Mail Queue would fill up quickly instead of sending everything at once. This gives you time to react, avoid a lot of trouble and can reduce the damage significantly.

Queue alerts warn you when the queue grows longer than usual. You configure in the settings at which threshold you want to be alerted. This gives you the chance to review the queue and investigate whether something unusual is happening on the website.

Optionally, you can enable automatic pausing when an alert is triggered. In that case the queue stops sending emails until you change the status back to Enabled.

Please note: This plugin sends at most one alert every six hours while the queue remains above the configured threshold.

Can I pause the queue without disabling the plugin?

Yes. The Mail Queue can be set to Paused.

When paused, the plugin still intercepts wp_mail() and stores outgoing emails in the queue, but no queued emails are sent until you change the status back to Enabled.

This is useful if you want to temporarily stop outgoing delivery without disabling the plugin completely.

是否能將高優先順序的電子郵件加入佇列?

Yes, you can add the custom X-Mail-Queue-Prio header set to High to your email. High priority emails are still processed through the normal Mail Queue cycle, but they are sent before normal queued emails.

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);

範例 2:為 Contact Form 7 聯絡表單電子郵件設定優先順序

在編輯 Contact Form 7 的聯絡表單時,僅需在 [電子郵件] 分頁的 [其他標頭] 欄位加入下列標頭即可。

X-Mail-Queue-Prio: High

是否能略過佇列立即傳送電子郵件?

可以,如果真的有這個需求,的確可以達成這個目標。

For this you can add the custom X-Mail-Queue-Prio header set to Instant to your email. These emails are sent immediately and bypass the queue. They still appear in the Mail Queue log so that their delivery remains visible.

請審慎考慮這樣做是否有潛在的安全性風險,並僅使用於例外狀況。

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);

範例 2:立即傳送 Contact Form 7 聯絡表單電子郵件

在編輯 Contact Form 7 的聯絡表單時,僅需在 [電子郵件] 分頁的 [其他標頭] 欄位加入下列標頭即可。

X-Mail-Queue-Prio: Instant

Can I send queued emails immediately from the backend?

Yes. In the Queue tab you can select one or more queued emails and use the Send now bulk action.

This sends the selected queued emails immediately without waiting for the next WP-Cron cycle.

The action is only available for queued emails that are still waiting in the queue.

What are queue events in the log?

In addition to email entries the Mail Queue log also shows queue events.

These entries document important queue state changes, for example when the queue was enabled, paused, disabled, and auto-paused automatically after an alert.

They are not outgoing emails. They are informational log entries to help you understand what happened and when.

Can I still use the wp_mail() function as usual?

可以,wp_mail() 函式可以如預期般執行。

When the Mail Queue is enabled or paused, calling wp_mail() normally returns true after the email has been accepted by the queue.

例外狀況:

如果因故無法將電子郵件儲存至資料庫中,wp_mail() 函式會傳回 false

If you explicitly send an email using the Instant priority header, the email is sent immediately instead of being queued, even if there is an error creating a log for it in the queue.

在多站網路中可以使用 Mail Queue 嗎?

可以,但是有若干限制。

請不要為整個多站網路啟用 Mail Queue,請改為為個別子網站啟用這個外掛,這個外掛便會順利執行。在未來的版本中,開發團隊會加入對多站網路的完整支援。

What is Mail Queues favorite song?

使用者評論

BERJAYA
2024 年 8 月 29 日
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👌
BERJAYA
2024 年 8 月 10 日
This is a good plugin. Easy to configure and use. Good support.
閱讀全部 7 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Mail Queue〉的開發相關工作。

參與者

〈Mail Queue〉外掛目前已有 2 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈Mail Queue〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.5.1

  • Minor bug and security fixes

1.5.0

  • Added queue status modes: Enabled, Paused, and Disabled
  • Added optional Auto-Pause on Alert
  • Added queue event log entries for status changes and auto-pause
  • Added Send now bulk action for queued emails
  • Automatically prioritize WordPress password reset emails
  • Improved admin notices and settings page structure
  • Updated FAQ examples and documentation
  • Minor bug fixes and improvements

1.4.6

  • Added support for the pre_wp_mail hook

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_mail hooks: 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.