Mail Subject Prefix Icon

Mail Subject Prefix 

Test and staging systems regularly send real emails — form submissions, workflow notifications, scheduler reports. Recipients often cannot tell whether a mail originates from the live system or a test system. The mail subject prefix indicator prepends the environment to the subject of every mail sent through the TYPO3 Mailer API (e.g. [Staging] Your registration), so the origin is visible at first glance in every inbox.

Mail Subject Prefix Example

Mail Subject Prefix Example

The prefix is applied via a listener on the BeforeMailerSentMessageEvent , covering all mails sent via TYPO3's Mailer API (frontend forms, backend notifications, scheduler tasks).

You can register the indicator in your ext_localconf.php:

ext_localconf.php
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;

Handler::addIndicator(
    triggers: [
        new Trigger\ApplicationContext('Testing')
    ],
    indicators: [
        new Indicator\Mail\SubjectPrefix([
            'prefix' => '[%context%] ',
        ])
    ]
);
Copied!

Additional optional configuration keys:

  • prefix (string): The prefix prepended to the mail subject. Default is [%context%] . The placeholder %context% is replaced with the current application context.
  • header (string): If set, an additional mail header with this name and the application context as value is added (e.g. X-Environment: Testing) for filtering/tooling. Default is empty (no header is added).

The mail subject prefix can be disabled globally via the extension configuration.