Preventing Mass Email Sending After Order Status Deletion in WooCommerce

In a recent Business Bloomer Club discussion, a member sought advice on handling a sudden flood of 25,000 triggered emails after a client accidentally deleted a custom order status in WooCommerce.

This error caused orders to transition to default statuses, triggering an email for each one. Concerned about reconnecting the SMTP server and potentially sending all the emails, they were looking for ways to pause or prevent further email distribution.

Here’s a step-by-step guide to managing and preventing mass email sending after such incidents.

Step 1: Temporarily Disable WooCommerce Emails

If you anticipate a high volume of unwanted emails due to status changes, temporarily disabling email notifications in WooCommerce can prevent them from sending once SMTP is reconnected.

How to Disable WooCommerce Emails

  1. Go to WooCommerce > Settings > Emails.
  2. Toggle off the email notifications that are unnecessary at the moment.
  3. Save changes to ensure the settings are updated.

Alternatively, you can use custom code to disable all WooCommerce emails temporarily:

add_filter('woocommerce_email_enabled', '__return_false');

Step 2: Check for Emails in Action Scheduler or SMTP Queue

In some cases, the emails may have been placed in WooCommerce’s Action Scheduler or the SMTP queue. Review these queues to determine whether emails are pending and if they can be cleared.

Reviewing Action Scheduler

  1. Go to WooCommerce > Status > Scheduled Actions.
  2. Check for any scheduled email actions that might still be pending.
  3. Bulk-cancel these actions if necessary to stop the email queue from resuming once SMTP is reconnected.

Clearing the SMTP Queue

  1. If the SMTP server is hosted externally, log in to the SMTP server interface.
  2. Check for queued emails and clear them, if possible, to prevent accidental sending when the server is reconnected.

Step 3: Use Plugins to Manage Email Notifications

If you prefer a plugin-based approach, WooCommerce offers several plugins that allow for fine-tuned control over email sending, including disabling specific notifications or setting email conditions.

  • WP Mail Logging: This plugin logs emails without sending them, so you can review what emails would have gone out.
  • WooCommerce Email Control: Allows you to manage and limit which emails are sent based on specific order statuses.

Final Thoughts

In scenarios where mass email triggering occurs, temporarily disabling WooCommerce’s email functionality and checking any queued emails in Action Scheduler or the SMTP server can prevent unwanted emails. To avoid future mishaps, use a staging environment for changes involving order statuses or critical settings in WooCommerce, and consider email management plugins for better control.

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

Reply

Your email address will not be published. Required fields are marked *