TYPO3 / direct_mail: The body of “Symfony\Component\Mime\Part\TextPart” must be a string or a resource (got “bool”)

Initial situation

The TYPO3 extension direct_mail does not send newsletters anymore. In the scheduler and in the system log the error message “Core: Exception handler (CLI): Uncaught TYPO3 Exception: The body of “Symfony\Component\Mime\Part\TextPart” must be a string or a resource (got “bool”). | TypeError thrown in file /…/vendor/symfony/mime/Part/TextPart.php in line 52″

Workaround

Edit the file /…/vendor/symfony/mime/Part/TextPart.php around line 52. Replace the line
if (!\is_string($body) && !\is_resource($body)) {
by
if (!\is_string($body) && !\is_resource($body) && !\is_bool($body)) {

This procedure is admittedly rather messy, but it will allow the newsletter to be sent again afterwards and embedded images will also be processed correctly.

Leave a Comment