How to clear pending and blocked email queue entries
Problem
When browsing to Utilities > Email Queue in the operator panel there are large number of pending and/or blocked emails in the queue which require manually retrying.
Cause
The cron failed to send the emails 5 times and manual intervention is now required to send the email.
Resolution
Firstly, we recommend to subscribe to cron errors so that you're alerted as soon as an email fails to send. Find out more.
Please take a database backup before running the below queries.
Retry sending pending and blocked emails
Pending emails would be scheduled to send automatically within the next 24 hours, but you can send them immediately:
UPDATE `email_queue` SET `attempt_at` = null;
To retry the blocked emails, you can reset the attempts to 0 and it will try 5 more times:
UPDATE `email_queue` SET `attempts` = 0 WHERE `attempts` >= 5;
Permanently delete blocked emails
To delete the blocked emails, you can run the following query:
DELETE FROM `email_queue` WHERE `attempts` > 4;