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
- The module hooks into WordPress’s
wp_mail()function - Every email sent through WordPress is logged before sending
- Logs include recipient, subject, message body, headers, and timestamp
- View logs in the Switchboard settings panel
- Old logs are automatically pruned to prevent database bloat
What Gets Logged
| Field | Description |
|---|---|
| To | Recipient email address(es) |
| Subject | Email subject line |
| Message | Full email body content |
| Headers | Email headers (From, Reply-To, Content-Type, etc.) |
| Sent Date | Timestamp 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
| Setting | Type | Default | Description |
|---|---|---|---|
| Log Limit | Number | 100 | Maximum 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:
| Header | Meaning |
|---|---|
| From | Sender email address |
| Reply-To | Where replies are sent |
| Content-Type | text/html or text/plain |
| X-Mailer | What sent the email |
| MIME-Version | Email format version |
Common Issues to Debug
“Password reset email not received”
- Check the log for the password reset email
- Verify the recipient address is correct
- Confirm the email was logged (if not, another plugin may be interfering)
- If logged but not delivered, the issue is with email delivery (try SMTP module)
“Contact form submissions missing”
- Search logs for the form submission time
- Verify the “To” address is correct
- Check if the message content appears correct
- If not logged, the form plugin may use a different sending method
“Customer notification looks wrong”
- Find the specific email in logs
- Expand to view full message body
- 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:
- View the logs you need
- Copy the relevant information
- 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 standardwp_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 throughwp_mail() are logged.Get access to all 147 modules with a single license