Search by

mouseketeers / silverstripe-mailcapture

olsen

Logs every email sent through Silverstripe's Symfony Mailer to the database and shows them in the CMS

Package info

github.com/Mouseketeers/silverstripe-mailcapture

Type:silverstripe-vendormodule

pkg:composer/mouseketeers/silverstripe-mailcapture

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.1.0 2026-10-09 15:44 UTC

This package is auto-updated.

Last update: 2026-11-19 21:23:31 UTC


README

Logs every email sent through Silverstripe's Symfony Mailer to the database and lists them in the CMS under Sent Emails. Replacement for the abandoned symbiote/silverstripe-mailcapture on Silverstripe 5.4 and 6.

How it works

Instead of replacing the mailer, an event subscriber listens for Symfony's MessageEvent, which fires just before each message is handed to the transport. The finished message (to, cc, bcc, from, subject, headers, HTML and plain text) is written to a CapturedEmail record. Sending is unchanged and uses whatever MAILER_DSN is configured. If logging fails, a warning is logged and the email still goes out.

Email::send() → Symfony Mailer → MessageEvent ─┬→ EmailLogListener → CapturedEmail
                                               └→ transport (MAILER_DSN) → recipient

Installation

composer require mouseketeers/silverstripe-mailcapture
vendor/bin/sake db:build --flush        # SS6
vendor/bin/sake dev/build flush=1       # SS5

Migrating from symbiote/silverstripe-mailcapture

The model uses the same CapturedEmail table and fields, and remaps the old class name, so existing records show up after dev/build. Remove the old module and any CaptureMailer Injector config first.

Configuration

Delete records older than N days (checked every time an email is captured; 0, the default, keeps everything):

Mouseketeers\MailCapture\Model\CapturedEmail:
  retention_days: 90

Log emails in development without sending them:

MAILER_DSN="null://null"

Sending again

Administrators can resend an email with the Send again button on its detail view. It goes to the original To/Cc/Bcc, From and Reply-To (taken from the X-Original-* headers if send_all_emails_to rewrote them), and the current send_all_emails_to settings apply again. Attachments are not stored, so they are not resent. The resent email is captured as a new record.

Permissions

Viewing needs access to the Sent Emails CMS section. Records are read-only; only administrators can resend or delete them.