Skip to content

Commit 8f5a17e

Browse files
[11.x] Improve Resend transport response handling (#54004)
1 parent 620f717 commit 8f5a17e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Illuminate/Mail/Transport/ResendTransport.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Exception;
66
use Resend\Contracts\Client;
7+
use Symfony\Component\HttpFoundation\Response;
78
use Symfony\Component\Mailer\Envelope;
89
use Symfony\Component\Mailer\Exception\TransportException;
910
use Symfony\Component\Mailer\SentMessage;
@@ -97,6 +98,8 @@ protected function doSend(SentMessage $message): void
9798
'text' => $email->getTextBody(),
9899
'attachments' => $attachments,
99100
]);
101+
102+
throw_if($result['statusCode'] != Response::HTTP_OK, Exception::class, $result['message']);
100103
} catch (Exception $exception) {
101104
throw new TransportException(
102105
sprintf('Request to Resend API failed. Reason: %s.', $exception->getMessage()),

0 commit comments

Comments
 (0)