How to Set Up Email Logging

Would you like to keep records of every email that’s sent out from your WordPress site? With WP Mail SMTP, you can easily enable email logging. Plus, you can quickly see if any emails were not sent successfully.

In this tutorial, we’ll show you how to enable email logs in WP Mail SMTP.


Before you get started, be sure to install and activate WP Mail SMTP on your WordPress site.

Configuring Email Logging

Once WP Mail SMTP is active, go to WP Mail SMTP » Settings. Then, click on the Email Log tab.

Open Email Log settings in WP Mail SMTP

Select the checkbox next to Keep a record of basic details for all emails sent from your site. After you’ve done so, additional settings for your email logs will appear as well.

Email logging options

We’ll go over each of these settings below.

Enable Log

The Enable Log setting will turn on email logging for your site once this option is checked.

After enabling this option, a record will be made of every future email sent out from your website. Details for each email record will include:

  • Email status (Delivered, Not Sent, Sent, Waiting for confirmation)
  • Date and time sent
  • Subject line
  • Recipient email address(es), including CC and BCC
  • From email
  • Number of attachments
  • Mailer used
  • Additional technical details (such as content-type, MIME, etc)
  • Source of the email (WordPress core, a plugin, or theme)

Log Email Content

If you decide to enable email logs, you’ll see an additional checkbox appear labeled Log Email Content. When this box is checked, your email logs will also include the actual content of the emails sent out from your site.

Note: Please consider carefully before enabling email content logging. Email content may include sensitive information, such as user login credentials. By enabling this option, all email content will be stored as plain text (not encrypted) in your site’s database.

Save Attachments

With this option enabled, all sent attachments will be saved to your WordPress Uploads folder. You can see the number of saved attachments in the Log Details section of an individual email log under Attachments.

Store email attachments

Open Email and Click Link Tracking

Enabling the Open Email Tracking option allows you to see if the email recipient has opened the email. The Click Link Tracking option lets you see if the recipient has clicked on any links in the email.

Open and clicked email tracking

Log Retention Period

The log retention period setting allows you to choose how long to store your logs in your site’s database. By default, this setting will be set to Forever, but you can change it to however long you’d like.

Once a log reaches the end of the retention period, it will be deleted automatically. Deleted logs cannot be recovered, so make sure you no longer need old email logs before setting up a log retention period.

Note: Would you like to manually remove email logs from your site? Check out our tutorial on how to delete email logs for step-by-step guidance.

Webhooks Status

Note: The Webhooks Status setting is only available if you’re using the following mailers:

If you do not see this setting and would like to use it, please set up one of the compatible mailers.

Additionally, the Webhooks Status setting is disabled for WordPress multisite installations. See our guide to using WP Mail SMTP with multisite for more details.

Some mailers let you use webhooks to monitor the delivery status of your emails. If you would like to use this feature, click on the Subscribe button to enable webhooks.

Subscribing to webhooks status updates

You’ll then see a popup with a success message.

The webhooks subscription success message

If you decide you no longer want to use webhooks to keep track of whether your emails have been delivered, you can return to your email log settings and click the Unsubscribe button.

Unsubscribing from webhooks status updates

Note: Please keep in mind that your mailer account may have webhooks subscriptions limitations. Check your mailer’s documentation for current limits.

Frequently Asked Questions

Here are the answers to some of the most common questions we see regarding email logs.

How can I change the WordPress capability for viewing and managing Email Logs?

With the following filters, you can allow users with the “read” capability to access (view) and manage (delete) Email Logs:

add_filter( 'wp_mail_smtp_admin_area_get_logs_access_capability', function ( $capability ) {
    return 'read';
} );

add_filter( 'wp_mail_smtp_pro_emails_logs_logs_get_manage_capability', function ( $capability ) {
    return 'read';
} );

To allow users with an Editor role to view the logs, but not manage or delete them, you can use the following filter:

add_filter( 'wp_mail_smtp_admin_area_get_logs_access_capability', function ( $capability ) {
    return 'edit_pages';
} );

Note: Not sure how to add custom code to your site? For extra guidance, please see WPBeginner’s tutorial on adding custom code.

That’s it! You can now set up email logging for your WordPress site using WP Mail SMTP.

Next, would you like to view the email logs your site has collected? See our guide to viewing email logs for details on how to see your email content, delivery status, source, technical details.