Exception handler for Mail API


I would like to integrate an exception handler into my extension when sending mail, to catch errors of the mailer when sending. Unfortunately the Mail API does not provide anything like this, see: https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Mail/Index.html

In the Symfony docs this is implemented with the TransportExceptionInterface, see:https://symfony.com/doc/current/mailer.html#handling-sending-failures
Unfortunately, this is not implemented in TYPO 3 (v10.4).

For now, I implemented a TYPO3\CMS\Core\Exception, since the Symfony\Component\Mailer\Transport uses it as well.

Has anyone already implemented an error handling for sending mail?

In TYPO3 12 there is now a new event: AfterMailerSentMessageEvent — TYPO3 Explained main documentation

Maybe it is possible to get the status.

Fot TYPO3 10 I do not have a useful solution.

Hi Stefan,

thank’s for the hint!

The update of the website to v12 will have to wait a while.