Skip to content

Commit cd04b5d

Browse files
committed
Soft fail user emails and log error
1 parent 2a90072 commit cd04b5d

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/Helper/User/UserMailer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ private function send(?RawMessage $message): void
9696
} catch (TransportExceptionInterface $exception) {
9797
$exception = new MailerTransportException($exception->getMessage());
9898
$exception->appendDebug($exception->getDebug());
99+
if ($logger = $this->container->get('logger')) {
100+
$logger->error($exception->getMessage(), [
101+
'exception' => $exception,
102+
]);
103+
return;
104+
}
99105
throw $exception;
100106
}
101107
}

src/Resources/config/services.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@
11901190
UsernameChangedEmailFactory::class => new Reference(UsernameChangedEmailFactory::class),
11911191
PasswordChangedEmailFactory::class => new Reference(PasswordChangedEmailFactory::class),
11921192
VerifyEmailFactory::class => new Reference(VerifyEmailFactory::class),
1193+
'logger' => new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)
11931194
]),
11941195
'', // injected in dependency injection
11951196
]

0 commit comments

Comments
 (0)