How to completely remove Post SMTP logged emails

Ciprian on Tuesday, March 8, 2022 in Blog, WordPress

NEW! Learn JavaScript by example. Code snippets, how-to's and tutorials. Try now!

How to completely remove Post SMTP logged emails and session transcripts

Post SMTP is an awesome WordPress plugin, but I recently ran into a big issue with one website where the database was too slow to respond, and the 250 logged emails weighed 450+ Mb in the database.

This issue (or a shared server) caused hundreds of errors in my error.log file:

WordPress database error Commands out of sync; you can’t run this command now for query [...]

Turning off email logging or changing the amount of logged emails did not remove the previously logged ones. There is no CRON job to run and delete these emails, so the only solution was to delete them straight from the database.

These are the queries I used to delete all logged emails. Nothing else is lost, API keys, email settings, sender settings, everything is preserved.

DELETE FROM `wp_postmeta` WHERE meta_key = 'session_transcript';
DELETE FROM `wp_postmeta` WHERE meta_key = 'original_headers';
DELETE FROM `wp_postmeta` WHERE meta_key = 'original_message';
DELETE FROM `wp_postmeta` WHERE meta_key = 'original_subject';
DELETE FROM `wp_postmeta` WHERE meta_key = 'original_to';
DELETE FROM `wp_postmeta` WHERE meta_key = 'transport_uri';
DELETE FROM `wp_postmeta` WHERE meta_key = 'reply_to_header';
DELETE FROM `wp_postmeta` WHERE meta_key = 'to_header';
DELETE FROM `wp_postmeta` WHERE meta_key = 'from_header';
DELETE FROM `wp_postmeta` WHERE meta_key = 'success';
DELETE FROM `wp_postmeta` WHERE meta_key = 'solution';

Related posts

Leave a Reply

You have to agree to the comment policy.

Follow me!

If you like this article, go ahead and follow me on Twitter or buy me a coffee to support my work!

Follow @getButterfly