---
title: "Feature: #97747 - Introduce MailerInterface"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-97747-1654691279"
source: "Changelog/12.1/Feature-97747-IntroduceMailerInterface.rst"
typo3-version: "12.1"
typo3-major: 12
type: "feature"
issue: 97747
forge: "https://forge.typo3.org/issues/97747"
tags: ["PHP-API", "ext:core"]
rendered: "2026-09-20T18:31:11+00:00"
---

# Feature: #97747 - Introduce MailerInterface {#feature-97747-1654691279}

See [forge#97747](https://forge.typo3.org/issues/97747)

## Description {#description}

To be able to use your own custom mailer implementation in the TYPO3 Core, an
interface `\TYPO3\CMS\Core\Mail\MailerInterface` is introduced, which extends
`\Symfony\Component\Mailer\MailerInterface`

By default, `\TYPO3\CMS\Core\Mail\Mailer` is registered as implementation in
`Configuration/Services.yaml`.

### Example {#example}

```php
use TYPO3\CMS\Core\Mail\MailerInterface;

class MyClass
{
    public function __construct(
        private readonly MailerInterface $mailer
    ) {
    }
}
```

Or where constructor injection is not possible:

```php
$mailer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailerInterface::class);
```

## Impact {#impact}

This change makes it possible to create your own `\My\Custom\Mailer` that implements
`\TYPO3\CMS\Core\Mail\MailerInterface` which is used by TYPO3 core. Therefore, it is recommended
to use the interface `\TYPO3\CMS\Core\Mail\MailerInterface`, to let dependency injection inject the
desired implementation for every `\TYPO3\CMS\Core\Mail\MailerInterface`.

Add the following line in `Configuration/Services.yaml`, to ensure that your custom
implementation can be injected.

```yaml
TYPO3\CMS\Core\Mail\MailerInterface:
  alias: My\Custom\Mailer
```
