Skip to content

Email Tracking settings: what is logged, queued and kept

Describes Emails 0.9.0.

The Email Tracking settings decide how the Emails module records your mail: whether outgoing messages go through a queue, how much of each message is stored, and how long the log is kept.

Where to find it

Open Settings → Email Sending and choose the Email Tracking tab. The address is /admin/settings/email-sending?tab=module_emails_tracking. The tab is shown to people with the Admin or Owner role, or a role with the Emails permission.

Checkboxes save as soon as you click them. Number and text fields save when you click outside them; each change confirms itself with a short message.

The Email Tracking tab of the email settings: what is logged, the sender and queue status, and switches for queueing, SES events, saving bodies and headers The Email Tracking tab of the email settings: what is logged, the sender and queue status, and switches for queueing, SES events, saving bodies and headers

Settings for what the Emails module records.

System status

The card at the top says whether logging actually works, not just whether it is switched on:

  • Logging: Recording, System off — nothing is written, or Blocked by sender address. In the last case a red note explains that the sender in Settings → Email Sending is not a full email address, so no log entry can be written until it is fixed.
  • What is logged: Every message, or System mail, plus %{rate}% of the rest when sampling is below 100%.
  • Sending through: the integration the mail goes out through, or the adapter set in the app’s config.
  • Sender: the from address.
  • Queue: off, or On — %{pending} waiting, %{executing} sending, %{retryable} retrying.
  • Authentication mail: Queued like everything else or Sent immediately, never queued.
  • Today: how many messages were logged, sent, failed and queued today.

The send queue

  • Queue Outgoing Emails: hands outgoing mail to a background queue instead of sending it while the page that triggered it is still loading. It needs an emails queue in the application’s Oban setup. Without one, the card shows Off — no :emails Oban queue, sending inline and a warning, and mail is sent immediately.
  • Queue Authentication Emails Too: shown while the queue is on. Off by default, so password resets and confirmations are sent at once and a stuck queue can’t hold them back.

A message with attachments is always sent immediately.

What is stored

  • Process Amazon SES events: handles delivery, bounce, complaint, open and click events from Amazon SES, both through SQS and through the SNS webhook. Turning it off stops both. Turning SES on in Delivery Event Tracking switches it back on.
  • Save Email Bodies: keeps the full content of each message, so it can be read on the email’s details page.
  • Save Email Headers: keeps the message headers too. This uses more storage.
  • Emails Sampling Rate: the percentage of messages to track in full, from 0 to 100. System mail is always tracked.

Data Retention

  • Email Retention Period: how many days to keep email data, from 1 to 365. Run Cleanup Now deletes the log entries older than that right away and tells you how many it removed.
  • Compress Email Bodies After: shown only while Save Email Bodies is on. After this many days (7 to 365), stored bodies are compressed to save space. Compress Now does it right away and reports how many bodies it compressed.

S3 archival

Enable S3 Archival moves old email data to an Amazon S3 bucket for long-term storage. While it is on:

  • S3 Bucket: the bucket name. Archives go under the email-logs/ prefix. Leave it empty to unset it.
  • Credentials for uploads: which Amazon connection from Settings → Integrations signs the uploads, or Environment or instance role to use keys from the server’s environment.

While archival is on and a bucket is set, cleanup keeps rows that haven’t been archived yet.

What it doesn’t do

  • The module has no scheduled cleanup. The Data Privacy Notice at the bottom says data is deleted automatically after the retention period, but in this version old entries are deleted when someone presses Run Cleanup Now (or a developer runs the cleanup).
  • Archiving runs only if the host application schedules it. Without that schedule entry nothing is uploaded, and the page says so. A developer adds it (see below).
  • Run Cleanup Now and Compress Now stop waiting after 30 and 60 seconds and report a timeout.
  • The sending address, sender name and transport are not set here; they live on the other tabs of Settings → Email Sending.
  • The rate limits and the blocklist on/off switch have no field on this page.

For developers

The send queue needs an emails queue in the host’s Oban config, for example queues: [emails: 10, ...]. S3 archival needs PhoenixKit.Modules.Emails.ArchiveWorker in the host’s Oban cron schedule (it is meant to run hourly).