Mails Module – User Guide
Table of Contents
The Mail Module provides WordPress administrators with a comprehensive email logging, monitoring, and
sending system. Every email sent via wp_mail() — whether from WordPress core, plugins, or themes — is
captured and stored in a searchable, filterable log with full metadata including delivery time, attachments, headers,
and originating plugin.
Additionally, the module allows you to configure an external SMTP provider for email delivery,
compose and send new emails directly from the admin, and resend previously sent
messages.
You need the Administrator role (the
manage_options capability) to access the Mailmodule. Other users will not see its menu items.
Enable / Disable the Module
The Mail module is a standalone module inside Advanced Analytics. You can enable or disable it without affecting any
other part of the plugin or WordPress email delivery itself.
- Navigate to Error Logs → Settings in the WordPress admin sidebar.
- Click the “Mail Options” tab (or scroll to the section headed Mail options).
- Toggle the “Enable email logging module” checkbox.
- Click Save Changes.
viewer sub-menu. It does not stop WordPress from sending emails. If you have SMTP settings configured,
those will also be deactivated when the module is disabled.
Module Settings
The Mail Options tab on the Settings page contains the following module-level settings:
1. Enable email logging module
| Type | Checkbox |
|---|---|
| Default | Enabled (checked) |
| Effect | Shows or hides the WP Mail sub-menu and all associated logging functionality. When disabled, no emails are captured to the database. |
2. Auto-clear mail logs
| Type | Dropdown (select) |
|---|---|
| Default | Never |
| Options | Never / Daily / Weekly / Monthly / Yearly |
| Effect | When a schedule is selected, a WordPress cron job is created to automatically truncate the mail log database table at the configured interval. Selecting “Never” disables automatic clearing. |
log entries when it runs. There is no undo. If you need to preserve email records, consider exporting to CSV
before the scheduled clear.
SMTP Provider Settings
The Mail Options tab also includes an External SMTP Provider section. When configured, all WordPress
emails will be routed through your external SMTP server instead of the server’s default mail handler (PHP
mail() or sendmail).
SMTP Configuration Fields
| Field | Type | Description |
|---|---|---|
| SMTP Host | Text | The hostname or IP address of your SMTP server (e.g., smtp.gmail.com,smtp.mailgun.org, email-smtp.us-east-1.amazonaws.com). |
| SMTP Port | Number | The port for your SMTP connection. Common values: 25 (unencrypted), 465(SSL), 587 (TLS/STARTTLS). Default: 587. Valid range: 1–65535. |
| Encryption Type | Radio buttons |
|
| SMTP Username | Text | The authentication username for your SMTP server. Often your full email address. |
| SMTP Password | Password | The authentication password or app-specific password. This is stored encrypted in the WordPress database. |
| From Email | Override the default “From” email address for all outgoing emails. Leave blank to use WordPress defaults. |
|
| From Name | Text | Override the default “From” display name. Leave blank to use WordPress defaults. |
| Bypass SSL Verification | Checkbox | Skip SSL certificate verification. Use only for development/local environments with self-signed certificates. Never enable on production sites. |
Popular SMTP Provider Configuration Examples
Gmail / Google Workspace
| SMTP Host | smtp.gmail.com |
|---|---|
| Port | 587 |
| Encryption | TLS |
| Username | Your full Gmail address |
| Password | App Password (generate at myaccount.google.com → Security → App Passwords) |
account passwords will be rejected.
Amazon SES
| SMTP Host | email-smtp.{region}.amazonaws.com |
|---|---|
| Port | 587 |
| Encryption | TLS |
| Username | Your SMTP credentials (not IAM User credentials) |
| Password | Your SMTP password |
Mailgun
| SMTP Host | smtp.mailgun.org |
|---|---|
| Port | 587 |
| Encryption | TLS |
| Username | Your Mailgun SMTP username |
| Password | Your Mailgun SMTP password |
SendGrid
| SMTP Host | smtp.sendgrid.net |
|---|---|
| Port | 587 |
| Encryption | TLS |
| Username | apikey (literal string) |
| Password | Your SendGrid API Key |
enabled. If you disable the module, emails revert to your server’s default mail handler.
Sending a Test Email
After configuring SMTP settings, verify your configuration works by sending a test email:
- In the Mail Options settings tab, scroll to the “Test Mail Delivery” section.
- Enter a recipient email address in the test field.
- Click “Send test mail”.
- A loading overlay appears while the email is being sent via AJAX.
- On success, you’ll see a “Test email sent successfully” alert. Check your inbox to confirm delivery.
your site URL and the current date/time, so you can easily identify it in your inbox.
password, and encryption type. Verify that your server can make outbound connections on the configured port. See the
Troubleshooting section for more details.
Mail Log List
This is the main screen. It shows every email sent (or attempted) by your WordPress site in a sortable, filterable table
with full metadata.
Columns
| Column | Sortable | Description |
|---|---|---|
| Date | Yes | When the email was sent. Displays relative labels like “Today”, “Yesterday” for recent emails, with the full timestamp. |
| To | Yes | Recipient email address(es). |
| From | Yes | Sender email address. Reflects SMTP “From” override if configured. |
| CC | Yes | Carbon-copy recipients (if any). |
| BCC | Yes | Blind carbon-copy recipients (if any). |
| Reply-To | Yes | Reply-to email address (if set in headers). |
| Subject | Yes | The email subject line. |
| Size | Yes | The message body size in bytes/KB/MB. |
| Category | Yes | Auto-detected email category (e.g., order, user, system). See Categories. |
| Format | Yes | Whether the email is HTML or Text. |
| Attachments | Yes | Lists attached files with links to the media library when available. |
| Attachment Count | Yes | Number of files attached to the email. |
| Delivery Time | Yes | Time taken to send the email, shown in milliseconds. |
| Plugin | Yes | The plugin (or theme/core component) that triggered the email, identified via backtrace analysis. |
Row Actions
Hover over any mail log row to reveal these actions:
- Details — Opens a modal overlay showing the full email body, all headers, attachment info,
delivery time, and metadata. - Resend — Re-sends the email with its original content and recipients. Only available for
non-time-sensitive emails (see Resending). - Delete — Removes the log entry from the database.
Status Indicators
Each row indicates the delivery status:
- Successful — Email was accepted for delivery by the mail server.
- Failed — Email delivery failed. The error message is stored and visible in
the details modal.
Filters & Views
View Tabs
Above the table you will find quick-filter links. Each shows a count in parentheses:
| Tab | Shows |
|---|---|
| All | Every logged email — no filtering applied. |
| Successful ✓ | Emails that were sent successfully (status = 1). |
| Unsuccessful ✗ | Emails that failed to send (status = 0). Error details are stored. |
| HTML HTML | Emails with HTML content type. |
| Text Text | Plain-text emails. |
| With attachments | Emails that include one or more file attachments. |
Dropdown Filters
Use the dropdown menus above the table then click Filter:
Plugin Filter
- Default: “All plugins”
- Lists every detected plugin that has sent at least one email.
- Narrows the table to only emails sent by the selected plugin.
Site Filter
- Available only on multisite networks for network administrators.
- Default: “All sites”
- Lists every site in the network to filter emails by originating site.
Searching Mail Logs
Use the search box in the top-right corner of the list page. The search queries across all columns —
you can search by recipient, sender, subject, message content, or any other stored field.
- Type your search term and press Enter or click Search.
- The search is case-insensitive.
- To clear the search, empty the box and press Enter.
Viewing Mail Details
Click Details on any row to open a modal popup showing the full email information:
Details Modal Contents
| Field | Description |
|---|---|
| To | Full recipient address(es) |
| From | Sender address |
| CC | Carbon-copy recipients |
| BCC | Blind carbon-copy recipients |
| Reply-To | Reply-to address |
| Subject | Email subject line |
| Category | Auto-detected category with color-coded badge |
| Message Body | Full email content rendered as HTML (or plain text) |
| Attachments | List of attached files with count and total size |
| Message Size | Body size in formatted units (bytes/KB/MB) |
| Total Size | Body + attachments combined size |
| Delivery Time | How long the email took to send (in milliseconds) |
| Can Resend | Whether the email is safe to resend (✓ or ✗) |
| Additional Headers | Raw email headers in JSON format |
The modal also includes Copy to clipboard and Share buttons for the email content.
Resending an Email
You can resend any previously logged email, provided it is not time-sensitive.
- Find the email in the log list.
- Hover over its row and click Resend (if available).
- The email is re-sent with its original To, CC, BCC, Reply-To, Subject, Body, and Attachments.
- A success or error notice appears at the top of the page.
are flagged as non-resendable. The system detects keywords such as:
- Password reset, verification code, verify your, confirm your
- One-time, expires, expiring
- 2FA, two-factor, authentication code, OTP
These emails show ✗ in the “Can Resend” indicator. Resending a password-reset email, for example,
would send an expired or already-used token.
Composing a New Email
You can compose and send new emails directly from the WordPress admin, complete with a rich-text editor, attachments,
and full header control.
- On the Mail Log list page, click “Compose New” (top of the page).
- Fill in the form fields:
- To (required) — Recipient email address(es), comma-separated for multiple.
- CC (optional) — Carbon-copy recipients, comma-separated.
- BCC (optional) — Blind carbon-copy recipients, comma-separated.
- Reply-To (optional) — Reply-to email address.
- Subject (required) — Email subject line.
- Attachments (optional) — Select files from the WordPress Media Library.
- Message (required) — Compose your email using the WordPress editor with full rich-text
formatting and media insertion.
- Click Send to dispatch the email.
through
wp_mail(), so your SMTP settings (if configured) apply, and the email is automatically loggedin the mail log.
are accepted as attachments. Paths outside the uploads directory are rejected for security reasons.
Email Categories
Every logged email is automatically categorized based on keywords detected in its subject and body. This helps you
quickly identify the type of emails your site sends.
| Category | Badge Color | Detected Keywords |
|---|---|---|
| order | Green | order, purchase, invoice, receipt, payment, checkout, cart |
| user | Blue | welcome, registration, account, profile, username, login |
| system | Red | error, critical, warning, debug, admin, update available, backup |
| marketing | Purple | newsletter, promotion, sale, discount, offer, subscribe, unsubscribe |
| notification | Orange | notification, alert, reminder, comment, reply, mention |
| transactional | Cyan | password, reset, verify, confirmation, code, token |
| general | Gray | Default — when no specific keywords are detected. |
logged and cannot be manually changed. They provide a quick visual indicator and can be used for filtering.
Attachments
The Mail module captures complete attachment information for every logged email:
- Attachment Count — Number of files attached.
- Attachment Total Size — Combined file size of all attachments.
- File Details — Each attachment records its URL, filename, MIME type, and media library icon.
Attachment Sources
- Media Library files — Attachments found in the WordPress media library display with their icon,
name, and a clickable URL. - Non-library files — Files not in the media library (e.g., dynamically generated PDFs) are
recorded with their file path and a note indicating they’re external to the media library.
Bulk Actions
Perform operations on multiple mail log entries at once:
- Check the boxes next to the entries you want to act on. Use the checkbox in the header row to select all visible
entries. - Open the Bulk actions dropdown.
- Choose Delete to permanently remove all selected entries.
- Click Apply.
CSV Export
Export the currently filtered/displayed mail logs to a CSV file:
- Apply any desired filters or search (the export respects your current filter context).
- Click the “CSV Export” button above the table.
- A progress bar appears during the export. You can click Cancel if needed.
- The CSV file downloads automatically once complete.
Screen Options
Click Screen Options (top-right of the page, just below the admin bar) to customize the display:
Items per page
Control how many log entries display per page. Enter a number and click Apply. Default is 20. This
only affects your user account.
Column Visibility
Check or uncheck columns to show or hide them. Useful for reducing clutter when you don’t need certain columns
(e.g., CC, BCC, Reply-To). Settings persist across sessions.
Auto-Clear Schedule
To prevent the mail log database table from growing indefinitely, you can configure automatic clearing:
- Navigate to Error Logs → Settings and open the Mail Options tab.
- Select a schedule from the “Auto-clear mail logs” dropdown:
- Never — Logs are kept forever (manual deletion only).
- Daily / Weekly / Monthly / Yearly — The entire mail log table is truncated on the
selected schedule.
- Click Save Changes.
A WordPress cron job (aadvana_mail_logging_clear) is scheduled to run at the configured interval. Changing
the schedule updates the cron job automatically.
entries older than the interval period. If you need to keep certain email records, export them before the next
scheduled clear.
Multisite Networks
On WordPress multisite installations, the Mail module provides additional capabilities:
- Blog ID tracking — Every logged email records which site (blog ID) triggered it.
- Site filter dropdown — Network administrators can filter the list to show emails from a
specific site. - Per-site logs — Each site in the network has its emails logged separately with site
identification.
Troubleshooting
SMTP Connection Failed
If test emails fail or emails stop being delivered after configuring SMTP:
- Check credentials — Verify the SMTP hostname, port, username, and password are correct.
- Check encryption — Ensure the encryption type matches the port (SSL → 465, TLS → 587).
- Firewall/port blocking — Some hosting providers block outbound SMTP ports. Contact your
host to verify ports 465 and 587 are open. - Self-signed certificates — If your SMTP uses a self-signed certificate (common in
development), enable “Bypass SSL Verification”. Never use this on production. - App passwords — Services like Gmail, Yahoo, and Outlook require app-specific passwords when
2FA is enabled. Regular account passwords will be rejected.
Emails Not Appearing in the Log
- Verify the Mail module is enabled in Settings.
- Check if another plugin (e.g., Post SMTP) is intercepting
wp_mail()before Advanced Analytics
can log it. The module has compatibility hooks for Post SMTP, but other mail plugins may conflict. - If using BuddyPress, the module automatically captures BuddyPress emails. Ensure both hooks are active.
Resend Button Not Showing
The Resend action is hidden for time-sensitive emails (password resets, verification codes, 2FA tokens, expiring
links). This is by design to prevent sending expired or already-used security tokens.
“From” Address Not Changing
If you’ve configured a “From Email” in SMTP settings but emails still show the old sender:
- Another plugin may be overriding the From address with a higher priority filter.
- Verify the SMTP settings are saved and the module is enabled.
- Check that the From address is a valid, verified sender for your SMTP provider (some providers like Amazon
SES require sender verification).
Large Database Tables
High-traffic sites sending many emails can accumulate large log tables. To manage this:
- Configure the Auto-Clear Schedule to periodically truncate logs.
- Use bulk delete to remove old entries manually.
- Export to CSV before clearing if you need to preserve records.
Error Messages Reference
| Message | Cause | Solution |
|---|---|---|
| “Could not authenticate” | SMTP username or password is incorrect | Double-check your credentials and try an app-specific password |
| “Connection timed out” | Server cannot reach SMTP host | Verify the host and port; check for firewall restrictions |
| “Certificate verify failed” | SSL/TLS certificate is invalid or self-signed | Enable “Bypass SSL Verification” for development; fix certificates for production |
| “Sender address rejected” | SMTP provider doesn’t allow this From address | Use a verified sender address for your SMTP provider |
See
Mails Module Developer Documentation for architectural details, class references, REST APIendpoints, hooks/filters, and code examples for extending the Mail module programmatically.