Using Mail Log
This guide is for the administrator or developer who needs to find out what happened to an email the site sent. Mail Log records every message Laravel’s mailer sends and shows it in a read-only list.
Tracing an email someone did not receive
Section titled “Tracing an email someone did not receive”- Open Developer > Mail log.
- Open the filters and type the person’s full address into Recipient address. Only an exact match is found, because addresses are stored as a code.
- Narrow the list with Date sent and, when you know it, Sent by (for example the password reset notification).
- Open the row to see its timeline.
What the status tells you:
| Status | What happened | What to do next |
|---|---|---|
| Sending | The mailer took the email but has not confirmed it yet. | Wait a minute. If it stays, the send was interrupted; the daily clean-up marks it failed after an hour. |
| Sent | The mail service accepted it. | If Postmark reports are connected and it never turns delivered, check the Postmark activity for the provider message ID. |
| Delivered | The recipient’s mail server accepted it. | Ask the person to check spam and filters. |
| Bounced | The recipient’s server refused it. | Read the reason. A hard bounce usually means the address does not exist. |
| Marked as spam | The recipient reported it as spam. | Postmark stops sending to that address until it is reactivated. |
| Suppressed | Postmark refused to send because the address is inactive. | Reactivate the address in Postmark if the person asks for mail again. |
| Failed | The send raised an error, or the mailer never confirmed it. | Read the reason, then check the mail settings and the application log for that time. |
Connecting Postmark delivery reports
Section titled “Connecting Postmark delivery reports”- Choose a username and a long random password and set them as
MAIL_LOG_POSTMARK_WEBHOOK_USERNAMEandMAIL_LOG_POSTMARK_WEBHOOK_PASSWORDon the server. If the site caches its configuration, runphp artisan config:cacheafterwards: until you do, the site keeps the old values and refuses Postmark’s requests. - In Postmark, open the server’s outbound message stream, add a webhook to
https://<your-site>/capell/webhooks/mail-log/postmark, enter the same username and password under Basic auth, and tick Delivery, Bounce and Spam Complaint. - Send a test from Postmark. Requests with missing or wrong credentials are refused and change nothing.
Checking the message catalogue
Section titled “Checking the message catalogue”Open Developer > Message catalogue to see every kind of message the site can send: emails, and notifications on any channel such as SMS, Slack or the admin panel. Messages found in installed code are listed before they are ever sent, with Times sent at 0 and Last sent as Never.
When a message the site has never sent before goes out, or a newly installed or upgraded package adds one, it is marked New and administrators who can read the mail log get one admin-panel notification. The message is still sent as normal. Check that it is expected, then choose Mark reviewed; this needs the Mark message catalogue sources reviewed permission as well as access to the mail log. Messages the framework itself sends, such as the admin panel’s own notifications, are listed as already reviewed and never raise an alert. A burst of Raw mail with no class that you did not expect is worth investigating: it is what code sending mail outside the site’s own emails looks like.
The catalogue refreshes when a package is installed or enabled and once a day. To refresh it straight after an upgrade, run php artisan capell:mail-log-discover; running it again changes nothing.
Each logged email also records the package that owns it and what sent it: a queued job, a console command or a named page route.
Holding a source that sends far more than usual
Section titled “Holding a source that sends far more than usual”The circuit breaker watches how many messages each source sends in a rolling hour. A source is held when it passes its hourly limit, sends many times its usual rate, or is raw mail with no class or a source first seen in the last day that suddenly sends in bulk. This is what injected code sending spam looks like. Past a site-wide hourly limit, every source is held.
Held messages are kept, encrypted, and never sent until you decide. One you leave undecided is discarded automatically once it is older than the retention setting, and a privacy erasure discards every held message addressed to the erased person. Administrators who can read the mail log get an admin-panel notification straight away, and the alert also goes to the addresses in CAPELL_MAIL_LOG_BREAKER_ALERT_MAIL and the Slack webhook in CAPELL_MAIL_LOG_BREAKER_ALERT_SLACK_WEBHOOK when they are set. Mail alerts are skipped when mail is what is being held.
Open Developer > Held messages to decide. You need the Release, discard and pause outbound messages permission.
- Release sends each selected message once. The source stays held.
- Discard deletes the selected messages without sending them. This cannot be undone.
- Resume a source lets new messages from that source go again, once you know why it was sending.
- Pause all messages holds everything the site sends until you choose Resume all messages.
Sign-in and security mail, such as password resets and email verification, is never held by the site-wide pause or limit, so people can still sign in during an attack. It is held only if its own source passes its own, higher limit. The limits, and the list of sign-in and security messages, are in the breaker section of config/mail-log.php.
Changing how long rows are kept
Section titled “Changing how long rows are kept”Open Extensions, choose Mail log and change Keep rows for. The daily clean-up deletes older rows the next time it runs. Switching Record outgoing email off stops new rows; existing rows stay until they age out.
Privacy
Section titled “Privacy”The log never stores the message text, attachments or a readable address. A privacy export lists the emails sent to the person, with their subject, sender within the site, status and times. A privacy erasure deletes the person’s entries; an email that also went to someone else stays for them with this person removed.
The subject line is kept as written, because it is what you search by when tracing an email. If your emails put a person’s name in the subject, an email that also went to other people keeps that subject after the person’s erasure. Keep names out of subjects for mail sent to several people at once.
Addresses are hashed with the site’s application key unless CAPELL_MAIL_LOG_HASH_SECRET is set. Changing that key changes every hash, so rows logged earlier no longer match a typed address and a privacy export or erasure will not find them. Ask your developer to set CAPELL_MAIL_LOG_HASH_SECRET to a long random value, separate from APP_KEY, before the first email is logged, and to keep it when the application key is rotated. The package health check warns while hashing still falls back to the application key.
Troubleshooting
Section titled “Troubleshooting”| What you see | What it means | What to do |
|---|---|---|
| The list is empty although the site sends email | Logging is switched off, or the package tables are missing | Check the Mail Log settings, then ask your developer to run php artisan capell:doctor and read the mail log checks |
| Rows stay at Sent and never show Delivered or Bounced | Postmark delivery reports are not reaching the site, or fail to authenticate | Ask your developer to check MAIL_LOG_POSTMARK_WEBHOOK_USERNAME, MAIL_LOG_POSTMARK_WEBHOOK_PASSWORD and the webhook URL, which ends in /capell/webhooks/mail-log/postmark |
| Postmark reports a 405 error when it calls the webhook | Mail Log is present but not installed, so the webhook address does not exist | Ask your developer to run php artisan capell:doctor and read the Mail Log checks, then install the extension with php artisan capell:extension-install capell-app/mail-log |
| A row is Failed because the mailer never confirmed the email | The process sending it stopped before the mail service answered | Ask your developer to read the queue worker and server logs from the time on the row |
| Old rows are not removed | The daily clean-up needs the Laravel scheduler | Ask your developer to check the scheduler, or run php artisan capell:mail-log-prune to remove them now |
Provider delivery reports
Section titled “Provider delivery reports”Point each provider’s webhook at your site, then set the matching secret in .env. Without its secret a provider’s endpoint refuses every request.
| Provider | Endpoint | Setting |
|---|---|---|
| Mailgun | /capell/webhooks/mail-log/mailgun | MAIL_LOG_MAILGUN_SIGNING_KEY (HTTP webhook signing key) |
| Resend | /capell/webhooks/mail-log/resend | MAIL_LOG_RESEND_WEBHOOK_SECRET (the whsec_ signing secret) |
| SES | /capell/webhooks/mail-log/ses | MAIL_LOG_SES_TOPIC_ARNS (comma-separated SNS topic ARNs you accept) |
For SES, create an SNS topic that your configuration sets publish to, subscribe the endpoint over HTTPS, and list the topic ARN in the setting above. The subscription confirms itself once the ARN is listed; messages from any other topic are refused.
Postmark, Mailgun and SES send opens and clicks only for messages where tracking was requested; the log adds the tracking headers itself for Postmark and Mailgun when a source has engagement switched on.
Opens and clicks
Section titled “Opens and clicks”Engagement tracking is off for every message source. Switch it on from the message catalogue with Record opens and clicks. Sign-in and security messages refuse it. The log stores the first time and a count only.
Spam complaints and suppression
Section titled “Spam complaints and suppression”Spam complaints lists complaints by source and by day, over a chosen period. A complaint or a hard bounce adds the recipient to the suppression list, and later sends skip that address. Security mail still goes to complainers but not to hard-bounced addresses. When every recipient of a message is suppressed, the message is not sent and is recorded as Suppressed.
Source health and alerts
Section titled “Source health and alerts”The message catalogue shows, for each source, how many messages it sent, failed, bounced and drew spam complaints in the last 24 hours, and whether it is Healthy or Alerting. Every hour the site checks each source against four limits:
| Limit | Default | Alerts when |
|---|---|---|
| Bounce rate | 5% | more than this share of sent messages bounced |
| Spam complaint rate | 0.1% | more than this share of sent messages were marked as spam |
| Failure rate | 10% | more than this share of send attempts were refused by the mail transport |
| Silence | 24 hours | a source that normally sends at least five messages a day has sent nothing for this long |
A rate is only judged once the source has sent at least 20 messages in the window, so a few messages never raise an alert. You are told once when a limit is crossed and once when the source recovers, never once per message. Alerts and recovery notices go to the administrators who subscribed to Mail health alerts in their notification preferences, which by default is everyone allowed to read the mail log.
To change a source’s limits, choose Alert limits on its row in the message catalogue. This needs the permission to mark sources reviewed. Set Silence to 0 to stop watching a source for silence. The daily operations digest carries a Mail health section with the day’s totals, the sources with the most problems and any open alerts.