Skip to content

Commit

Permalink
[BUGFIX] Catch Email Transport Exceptions #1313
Browse files Browse the repository at this point in the history
  • Loading branch information
derhansen committed Feb 6, 2025
1 parent 6aea742 commit 6405d23
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Classes/Service/EmailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace DERHANSEN\SfEventMgt\Service;

use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mime\Address;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Mail\FluidEmail;
Expand Down Expand Up @@ -73,8 +74,13 @@ public function sendEmailMessage(
}

$mailer = GeneralUtility::makeInstance(MailerInterface::class);
$mailer->send($email);
return $mailer->getSentMessage() !== null;

try {
$mailer->send($email);
return $mailer->getSentMessage() !== null;
} catch (TransportExceptionInterface $e) {
return false;
}
}

private function getEmailObject(bool $useFluidEmail): MailMessage|FluidEmail
Expand Down

0 comments on commit 6405d23

Please sign in to comment.