A Simple Guide to WordPress Email Logging

Illustration by Liquidink Design Illustration of two penguins and logs

Unsure if WordPress is sending any emails? Start logging them now so you have a trace of them since WordPress doesn’t do so by default.

Logging WordPress emails is vital in both understanding the emails that your WordPress sends, and also assisting in debugging issues with WordPress not sending any emails. 

In this guide, we’ll cover how you can use plugins to assist with logging WordPress emails and how you can then use that information to help diagnose issues. 

Which emails does WordPress send?

Out the box, WordPress sends the following emails. Some of the emails mentioned below, such as those sent by WooCommerce, only send, of course, if you have WooCommerce activated. 

  • WordPress password reset emails.
  • WordPress new account notification emails.
  • All other core WordPress emails. 
  • All WooCommerce emails (new order, payments, invoices etc). 
  • Contact form submissions from plugins like Gravity Forms and Contact Form 7.

While the above is by no means an exhaustive list but rest assured if the email is sent using wp_mail, it’ll be logged! 

Why bother logging WordPress emails? 

Logging WordPress emails is essential to monitor the overall deliverability of all your WordPress emails. Moreover the greater overall health of your WordPress site. If emails aren’t sending, you could have other problems with your site as well as it most likely means there’s an issue with core WordPress functionality. 

How to log emails in WordPress?

Logging WordPress emails couldn’t be easier thanks to the WP Mail Logging plugin. Follow our easy 4 step guide to start logging your WordPress emails. 

Highlights of functionality and stats

  • 70,000+ active installs.
  • Trusted since 2014. 
  • Logs all emails that use the wp_mail function.
  • Zero configuration, just activate the plugin and it’ll do the rest. 

Step 1: Install the plugin WP Mail Logging 

To install the plugin go to your wp-admin > Plugins > Add new and search for “WP Mail Logging.

Screenshot of searching for WP Mail Logging plugin

Click on “install now” and then activate the plugin. 

Step 2: Force WordPress to send an email

Log out of your WordPress site and then reset your password to force WordPress to send an email. Once logged out of your site go to your login page. E.g. example.com/wp-login.php.

On that page click the “Lost password” text:

Screenshot of WordPress login page with highlighted lost your password link.

And then enter your email address to request a password reset. You should then see the logged email in step 3 below. 

Step 3: View logged WordPress emails

With the plugin installed, it’ll automatically start logging all emails on your site with the exception of emails sent by plugins that don’t use wp_mail. The wp_mail function is an internal function used by WordPress to send emails from your site. It acts as a wrapper for the standard PHPMailer class. 

While most plugins utilize the wp_mail there are some that send emails using other libraries/packages including MailPoet which means they won’t be logged using WP Mail Logging. 

To see your logged emails, go to your wp-admin > WP Mail > Log.

Screenshot of the email log in WP Mail Logging showing three logged emails.

Here all your emails will be visible along with their headers and any errors (if applicable). What the plugin can’t show is if the email was delivered, this is beyond the scope of functionality. Rather the plugin shows if the email was sent by WordPress (e.g. wp_mail encountered no errors when sending). 

Step 4: View headers of a sent email from WordPress 

To help you in diagnosing any email deliverability issues and sending issues the plugin logs the full headers in most cases. 

To view the headers of a logged email click on “View” button, as shown in the screenshot above, under the message column. 

Screenshot of headers of a logged email from WP Mail logging.

You’ll be able to see all relevant details of the sent email including:

  • Time sent
  • Host
  • Receiver
  • Subject
  • Message body
  • Headers
  • Attachments
  • Errors.

Using the newfound information from WP Mail Logging you’ll now be able to easily and quickly see any errors with wp_mail.

One example of an error would be SMTP ERROR: Failed to connect to server:  (0) this means that wp_mail/PHP Mail couldn’t connect to your server at all and the most common reason is a certificate mismatch caused by the mailure host on your server. The fix is to use your mail servers name as your hostname when trying to connect. 

If you’re hosting with a shared host or a managed WordPress host their support team would be able to resolve that for you. 

How to check if your WordPress really sends the emails you log

Just because the email was logged it doesn’t mean the email sent was or delivered. A logged emails only means that wp_mail was able to successfully create the email and attempt to send. 

How to check if your emails get delivered easily then?

The easiest way to check is to use the Check Email plugin.

  1. Install the Check Email plugin.
  2. Go to your wp-admin > Tools > Check Email.
  3. Open a new tab, and copy the email address on mail-tester.com to which you will send your test email to. Why? Because mail-tester doesn’t filter emails or block them like Gmail or Yahoo might do.
  4. Go back Check Email and send an email to your mail-tester address. 
  5. Return to the mail-tester.com, and click to see if the email has been received. 

Why your emails may not send

We’ve written a definitive guide on diagnosing WordPress email sending issues that covers all the reasons why your WordPress might not send your emails. A must read if your emails are being logged but still not being received.  

And if you’re still having deliverability issues, consider using an SMTP plugin to route your WordPress emails via Amazon SES, Sendgrid or any other SMTP provider. 

Conclusion

Logging WordPress emails makes it far less frustrating when trying to diagnose issues allowing, you to at least see your website sent the emails. Combined with the Check Email you have the perfect toolkit in helping you discover and log issues with your WordPress emails.
Interested in learning more about email in WordPress? Check out our comprehensive guide on all things related to email in WordPress.