Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
AfterMailerInitializationEvent
This event is fired once a new Mailer is instantiated with specific transport settings. So it is possible to add custom mailing settings.
Example
An example listener, which hooks into the Mailer API to modify Mailer settings to not send any emails, could look like this:
namespace MyCompany\MyPackage\EventListener;
use TYPO3\CMS\Core\Mail\Event\AfterMailerInitializationEvent;
final class NullMailer
{
public function __invoke(AfterMailerInitializationEvent $event): void
{
$event->getMailer()->injectMailSettings(['transport' => 'null']);
}
}
Copied!