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 and use email logs in WP Mail SMTP.


Configuring Email Logging

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

Once the plugin is active, you’ll need to go to WP Mail SMTP » Settings. Then, click on the Email Log tab.

Open Email Log settings in WP Mail SMTP

After you’ve opened the Email Log page, you’ll see all the available settings for your email logs.

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 options used
  • Additional technical details (such as content-type, MIME, etc)

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 emails sent out from your site.

Note: Please consider carefully before enabling email content logging. Email content may include sensitive information, such as user logins. 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, and the Click Link Tracking option allows you to see if the recipient has clicked on any links within 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 within your site. By default, this setting will be set to Forever, but you can change this to however long you’d like.

Viewing Email Logs

To view your email logs, click on WP Mail SMTP » Email Log in the WordPress admin menu.

This will take you to the main email log page, which will display all logged emails. By default, the newest logs will be shown at the top of the list.

Email log in WP Mail SMTP

To see more details for a specific entry, you can click on the Subject for any log. This will open up a page for the individual email log.

View individual email log

Viewing Network Admin Aggregate Email Log (WordPress Multisites)

For WordPress Multisite installations, you have the option to view an aggregate email log of all your subsites in one place. To do this from the WordPress dashboard, you’ll need to go to My Sites » Network Admin. Then, in the WordPress admin sidebar navigate to WP Mail SMTP » Email Log.

This will take you to the Email Log page where you can view an aggregate email log for all your subsites. To view an email log for a single subsite, you can select the subsite of your choice from the dropdown menu in the top-right corner of the page, next to Site.

Network admin aggregated email log

Viewing Email Content

If you’d like to view the logged email’s content, click the View Email button under the entry you’d like to see.

View email content

This will open an overlay containing the content of the email body.

Email preview within email log

Printing Email Logs

To print an individual email log, click on the Print option in the Actions menu.

Print email logs

Once you’ve clicked on the Print option, you’ll be directed to a print preview page for the email log. Here you can review the email log, and once you’re ready, click on the Print button.

Print email log

If you’d like to reduce the size of the email log while printing, then select the Compact View option at the top-right corner of the page.

Click compact view

Here’s how the print preview page looks when Compact View is selected:

Compact-print-view

Exporting Email Logs

Within the right Actions menu of the individual email log’s page, you’ll see three export options. From this list, you can select Export (CSV) to download your email log in CSV form, Export (XLSX) to download your email log in an Excel format, or the Export (EML) option to download your email log as an EML file.

Export email log

Resending Emails

To resend an email, click on Resend within the Actions menu of an individual email log.

Resend email

After you click Resend, a confirmation pop-up will appear with an option to modify the email recipient.  If you’d like to add multiple recipients, be sure to separate each one with a comma.

Once you’re ready, click the Yes button to resend the email.

Resend email confirmation

When the email is successfully resent, another pop-up will appear that reads Email was successfully sent!

Email sent successfully

Viewing Technical Details

To view technical details about your email, click on the Technical Details text from within the individual email log.

click-technical-details

Here you will see information such as the email’s headers and error messages for failed email delivery.

view-technical-details

Searching and Filtering Emails

WP Mail SMTP makes it easy to search email logs for Email Addresses, Subject & Headers, and Content, or you can filter entries by date. To do this, go to WP Mail SMTP » Email Log and add your search and/or date filter requirements.

Search and filter email logs

Changing Screen Options

To change the layout of the Email Log page, go to WP Mail SMTP » Email Log, then click on Screen Options at the top-right corner of the page.

Screen options

Once you click Screen Options, you’ll be able to change the Columns and Pagination of the Email Log page.

Column and pagination options

Frequently Asked Questions

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

With the following filters, you can allow a user with the ‘read’ capability to access (view) and manage (delete) the 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 a user 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';
} );

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

Next, would you like to know how to set up a mailer in WP Mail SMTP? Be sure to check out our complete guide to WP Mail SMTP mailers for help deciding which mailer is likely to be the best fit for your site.