WP Mail Logging

Log every email WordPress sends, including password resets, notifications, form submissions, and plugin emails. When emails aren’t arriving or you need to troubleshoot delivery issues, this module shows you exactly what was sent and when.

Use Cases

  • Debug why password reset emails aren’t arriving
  • Verify contact form submissions are being sent
  • Check what WooCommerce or other plugins are emailing customers
  • Audit all outgoing emails for compliance
  • Troubleshoot SMTP configuration issues
  • Confirm notification emails contain correct content

How It Works

  1. The module hooks into WordPress’s wp_mail() function
  2. Every email sent through WordPress is logged before sending
  3. Logs include recipient, subject, message body, headers, and timestamp
  4. View logs in the Switchboard settings panel
  5. Old logs are automatically pruned to prevent database bloat

What Gets Logged

FieldDescription
ToRecipient email address(es)
SubjectEmail subject line
MessageFull email body content
HeadersEmail headers (From, Reply-To, Content-Type, etc.)
Sent DateTimestamp when the email was processed

Where to Find It

View email logs in the module settings panel within Switchboard. The logs appear as an expandable list—click any entry to see the full message content and headers.

Settings

SettingTypeDefaultDescription
Log LimitNumber100Maximum emails to keep in the log

Adjust the limit based on your needs:

  • Low traffic sites: 50-100 is usually sufficient
  • Active sites: 200-500 for more history
  • Debugging: Temporarily increase to 500+ when troubleshooting

Viewing Logs

The log interface shows:

  • Subject line prominently displayed
  • Recipient email address
  • Timestamp when sent
  • Expandable details with full message and headers

Click any log entry to expand and see:

  • Complete message body (HTML or plain text)
  • All email headers
  • Any custom headers from plugins

Searching Logs

Use the search box to filter emails by:

  • Subject line keywords
  • Recipient email address

This helps you quickly find specific emails in a large log.

Understanding Email Headers

Headers tell you how the email was configured:

HeaderMeaning
FromSender email address
Reply-ToWhere replies are sent
Content-Typetext/html or text/plain
X-MailerWhat sent the email
MIME-VersionEmail format version

Common Issues to Debug

“Password reset email not received”

  1. Check the log for the password reset email
  2. Verify the recipient address is correct
  3. Confirm the email was logged (if not, another plugin may be interfering)
  4. If logged but not delivered, the issue is with email delivery (try SMTP module)

“Contact form submissions missing”

  1. Search logs for the form submission time
  2. Verify the “To” address is correct
  3. Check if the message content appears correct
  4. If not logged, the form plugin may use a different sending method

“Customer notification looks wrong”

  1. Find the specific email in logs
  2. Expand to view full message body
  3. Check for missing content, broken HTML, or wrong data

Email Logging vs Email Delivery

This module logs emails but doesn’t control delivery.

  • Logged but not delivered: Email sent by WordPress but blocked by server/spam
  • Not logged: Something prevented wp_mail() from being called

For delivery issues, pair this module with Email SMTP to route emails through a reliable mail service.

Data Retention

Logs are automatically pruned to your configured limit:

  • When a new email is logged
  • Oldest entries beyond the limit are deleted
  • Prevents database bloat on active sites

For example, with a limit of 100:

  • Email #101 is logged
  • Email #1 (oldest) is automatically deleted
  • Always keeps the most recent 100 emails

Security Considerations

Email logs may contain sensitive information:

  • Password reset links
  • Customer order details
  • Personal information from forms
  • Private notifications

Access to email logs is restricted to administrators only. Consider:

  • Keeping log limits reasonable
  • Reviewing logs for sensitive data before sharing
  • Using this primarily for debugging, not permanent records

Exporting Logs

Currently, logs are viewable in the admin panel. To export:

  1. View the logs you need
  2. Copy the relevant information
  3. Or use browser developer tools to extract data

For formal auditing requirements, consider a dedicated email logging solution with export features.

FAQ

Does this affect email delivery?No. The module only logs emails—it doesn’t modify, delay, or interfere with the actual sending process.
Will it log emails from all plugins?Yes, as long as plugins use WordPress’s standard wp_mail() function. Some plugins (rare) may use direct PHP mail or their own SMTP, which won’t be captured.
Why was an email logged but not delivered?Logging happens before delivery. If logged but not received, the issue is with email delivery—check spam folders, verify SMTP settings, or contact your host about email restrictions.
Can I resend a logged email?Not directly from this module. You can view the content and manually resend, or trigger the action that sent it originally (like a new password reset request).
How long are logs kept?Logs are kept based on your Log Limit setting. When the limit is reached, the oldest entries are automatically deleted as new ones are added.
Does this work with WooCommerce?Yes. All WooCommerce emails (order confirmations, shipping notifications, etc.) that go through wp_mail() are logged.
PRO

Get access to all 147 modules with a single license

Upgrade to Pro