Install SMTP and Email Logs for WordPress, enter your provider's SMTP details and test them, then read each email's status and error. The log shows acceptance by your mail server, not delivery.
Contents10 sections
- 01Why log your email, and what the plugin does not do
- 02What you need
- 03Step-by-step setup
- 04How the SMTP password is stored
- 05What the log records, and what it leaves out
- 06Find out why an email failed
- 07Test email and connection check
- 08Retention and automatic deletion
- 09Good to know and troubleshooting
- 10Links
To send WordPress email through your own SMTP server and keep a log of the emails your site sends, install SMTP and Email Logs for WordPress, enter your provider’s details under Tools → Email Logs → SMTP Settings, tick Enable SMTP, save and press Send Test Email. Each email sent with wp_mail() then gets a row in the log, with a status and, for a failure, the exact error. One limit to know before you start: the log can show that your mail server accepted a message, but not that it reached the inbox.
Why log your email, and what the plugin does not do
When a customer says a password reset never arrived, WordPress tells you nothing by itself. A log shows whether the site tried to send it, which plugin sent it and what the mail server answered. The limits:
- It records only emails sent through
wp_mail(). A plugin that uses a mail service’s own API or mailer bypasses it and cannot be logged. - It does not resend or queue mail, track opens and clicks, or read bounce messages.
- It does not fall back to PHP mail: with SMTP on but incomplete, emails fail with a clear message.
What you need
- WordPress 6.2 or later (tested up to 7.1) and PHP 7.4 or later. WooCommerce is optional; when it is active, its emails are linked to their order.
- For SMTP: the host, port and login from your email provider, and a web host that allows outgoing connections on that port.
- An administrator account: only users who can manage options see the logs and settings.
- The plugin is paid, but no feature in its code checks the licence. Plugins → WpExperts Hub Licences activates your licence key for updates and sends only the plugin slug, the key, your site address and the plugin version to wpexpertshub.com, never log or message data.
Step-by-step setup
- Download the plugin zip under My Account → Downloads on wpexpertshub.com.
- Open Plugins → Add Plugin → Upload Plugin, choose the zip, click Install Now, then Activate Plugin. Logging starts at once and SMTP stays off.
- Open Tools → Email Logs → SMTP Settings, choose Encryption and enter SMTP host and SMTP port from your provider. Usual pairs are STARTTLS / TLS with 587 and SSL with 465.
- Keep Authentication ticked if the server needs a login, then enter SMTP username and SMTP password. Many providers want an app password or API key.
- Enter From name and From email address. Most providers only accept an address that belongs to your account or a verified domain.
- Tick Enable SMTP and click Save SMTP settings. Saving sends nothing. If the settings are incomplete, they are saved but SMTP stays off, and the notice says what is missing.
- Test it: click Check connection, then Send Test Email, then look for the message with the Test label in the Email Logs tab.
How the SMTP password is stored
- In the database: a saved password sits in the option
wphub_smtp_logs_smtp, encrypted with libsodium under a key derived from your site’s authentication keys and salts. - What that protects: a copied database or dump. It does not protect against someone who can read both the database and
wp-config.php, or against an administrator account. - Never shown again: typing a new password replaces the saved one, an empty field keeps it, and Remove the saved password deletes it.
- If the secret keys change: the saved password can no longer be decrypted. The screen says so, and with authentication on, emails fail until you enter it again.
For production sites the plugin recommends defining the settings in wp-config.php instead. A constant wins over the saved value and locks its field:
define( 'WPHUB_SMTP_LOGS_ENABLED', true );
define( 'WPHUB_SMTP_LOGS_HOST', 'smtp.example.com' );
define( 'WPHUB_SMTP_LOGS_PORT', 587 );
define( 'WPHUB_SMTP_LOGS_ENCRYPTION', 'tls' ); // none | ssl | tls
define( 'WPHUB_SMTP_LOGS_AUTH', true );
define( 'WPHUB_SMTP_LOGS_USER', 'username' );
define( 'WPHUB_SMTP_LOGS_PASS', getenv( 'SMTP_PASSWORD' ) );The same prefix accepts _FROM_EMAIL, _FROM_NAME, _FORCE_FROM_EMAIL, _FORCE_FROM_NAME, _REPLY_TO, _TIMEOUT and _VERIFY_CERT. Do not leave out WPHUB_SMTP_LOGS_ENABLED: with the host or login only in constants, ticking Enable SMTP on the screen fails, because the save checks the database values, not the constants, and reports them as missing.
What the log records, and what it leaves out
A row is written when WordPress calls wp_mail(), before anything is sent, and updated when the result arrives. An email that crashes halfway keeps its row with the status Unknown.
- Recorded: date and time, status, recipients (to, cc, bcc, reply-to), sender, subject, the headers passed to
wp_mail()(authorization, cookie and token headers are masked) and the mail transport, which shows whether the email left through your SMTP server or PHPmail(). - Who sent it: the Source column names the plugin, theme, WordPress function or WooCommerce email that called
wp_mail(). - Message body: stored by default (Store the message body) and cut at about 1 MB. With Hide reset keys, tokens and one-time codes in stored messages on, the secret part of links such as
key=ortoken=and one-time codes become [redacted]. Only common patterns are recognised. - Failures: the error, a short explanation, the server reply and about the last 40 lines of the conversation with the server. The SMTP password is removed from all of it, and the login exchange is blanked.
Attachments are kept as name, type and size only, never the file. With Store the message body off, a log has no message and no preview, but recipient, subject, status and errors are still recorded. Mask recipient addresses in the log list changes the list only: the detail screen, exports and search use the full address.
One exception: if a failure comes after the message went to the server (for example a rejection at the end), the stored conversation can include its last lines: headers, the end of the text and, with an attachment, encoded file data. Store the message body and the hiding of reset keys do not apply to them, so a reset link can show there. Earlier failures never reach the message.
Find out why an email failed
- Open Tools → Email Logs and click Failed above the list. Search covers recipients, subject and log ID, not the message body.
- Click the date or subject to open the log. A failed email has an Error card with a label such as “Authentication failed”, a suggestion, the exact error, the server reply and the SMTP conversation.
- Click Copy error details for your host or provider. The conversation contains sender and recipient addresses and can contain message lines, so read it before you paste it into a ticket.
The label comes from matching words in the error text, so treat it as a lead and the exact error as the evidence. The Diagnostics tab lists the latest 10 failed emails, the last test and connection check and the cleanup history.
What the three statuses prove
- Sent: the mail transport accepted the message. It does not prove delivery. Check the spam folder, your provider’s delivery log, and SPF, DKIM and DMARC for the From domain.
- Failed: WordPress reported a sending failure.
- Unknown: the outcome could not be determined, for example because another plugin took over the sending.
A missing row does not prove nothing was sent: Email logging or a Which emails box may be off, the mail may bypass wp_mail(), or cleanup may have deleted the row.
Test email and connection check
- Send Test Email: sends a real message through
wp_mail()and logs it with a Test label. The result reads “Accepted by the mail transport”, “Test failed” or “Outcome unknown”. With SMTP off it runs a “Default mail test (SMTP is off)” instead. - Check connection: connects, starts encryption, logs in and disconnects without sending anything, and lists each step as passed or failed.
- Limits: both use the saved settings, so save first, and Check connection stays disabled until SMTP is on. A passing check does not test your From address or any recipient, and a passing test email only says the transport accepted it.
According to its documentation, the plugin has not been tested against every mail provider, so run both checks with your own details first.
Retention and automatic deletion
Open Tools → Email Logs → General Settings. Under Automatic log cleanup, Enable automatic deletion is on by default and Retention period is 90 days. Choose 7, 15, 30, 60, 90, 180 or 365 days, or Custom number of days from 1 to 3650.
- The rule: a log is deleted once it was created more than that many days ago.
- The schedule: once a day, through Action Scheduler (included with WooCommerce) when it is loaded and WP-Cron otherwise, in batches of 500. Changing the retention period or the automatic deletion switch re-creates the task, so the next run is about an hour after you save.
- Saving deletes nothing itself: older logs go at the next cleanup, so, with automatic deletion on, shortening the period removes them for good in about an hour. Turning Email logging off deletes nothing, and old logs still expire.
- Run Cleanup Now applies the saved retention at once, even with automatic deletion off. Delete All Logs is separate and empties the table. Both ask for confirmation and cannot be undone.
- Status: Cleanup status and maintenance shows the last run, deletions, errors and the next run.
Deactivating the plugin stops logging, SMTP and the cleanup and deletes nothing. Deleting it keeps your logs and settings unless you first ticked Data when the plugin is deleted, which removes logs, settings and the saved SMTP password for good. The logs are included in WordPress’s personal data export and erase tools.
Good to know and troubleshooting
- SMTP is on but nothing is sent: host, port and, with authentication on, username and password must all be set. Otherwise emails fail on purpose, the log says why, and a red notice with “Fix the SMTP settings” appears for administrators.
- Enable SMTP stays off and the notice says the host or login is missing: they are constants, so also define
WPHUB_SMTP_LOGS_ENABLED. - Authentication failed: re-enter the password (an empty field keeps the old one) and try an app password or API key.
- Connection refused or timed out: host, port and encryption must fit together. A firewall that drops the traffic is the usual cause, so ask your host about outgoing SMTP ports.
- TLS or certificate error: the encryption must match the port and the certificate must match the host name. Unticking Server certificate only hides the problem and stops checking the server’s identity, and Encryption None sends the password unencrypted.
- Sender not allowed: use a From address your provider accepts. Without the Force options, your From name and address replace only WordPress’s defaults, not a sender a plugin chose.
- Many emails show Unknown: another plugin may have taken over the sending through the
pre_wp_mailfilter, so no outcome is visible. Check that plugin’s own log. - Cleanup does not run: if WP-Cron is disabled and Action Scheduler is absent, run
wp cron event run wphub_smtp_logs_cleanupfrom a server cron job or press Run Cleanup Now.
The full documentation covers CSV export, developer hooks, the data model and the changelog.
Links
Plugin page: SMTP and Email Logs for WordPress. Settings reference: SMTP and Email Logs for WordPress documentation. More tools: Browse all plugins.