From d96d291591ca0df2758a30c667dd9584fcb719fc Mon Sep 17 00:00:00 2001 From: Nikola Markovic Date: Mon, 23 Dec 2024 17:40:44 +0100 Subject: [PATCH] [11.x] Improve Resend transport response handling --- src/Illuminate/Mail/Transport/ResendTransport.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Illuminate/Mail/Transport/ResendTransport.php b/src/Illuminate/Mail/Transport/ResendTransport.php index 43557fc159cd..c5576d7cebfc 100644 --- a/src/Illuminate/Mail/Transport/ResendTransport.php +++ b/src/Illuminate/Mail/Transport/ResendTransport.php @@ -4,6 +4,7 @@ use Exception; use Resend\Contracts\Client; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Mailer\Envelope; use Symfony\Component\Mailer\Exception\TransportException; use Symfony\Component\Mailer\SentMessage; @@ -97,6 +98,8 @@ protected function doSend(SentMessage $message): void 'text' => $email->getTextBody(), 'attachments' => $attachments, ]); + + throw_if($result['statusCode'] != Response::HTTP_OK, Exception::class, $result['message']); } catch (Exception $exception) { throw new TransportException( sprintf('Request to Resend API failed. Reason: %s.', $exception->getMessage()),