Skip to content

Commit

Permalink
[11.x] Improve Resend transport response handling
Browse files Browse the repository at this point in the history
  • Loading branch information
markovic-nikola authored Dec 23, 2024
1 parent 620f717 commit d96d291
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Illuminate/Mail/Transport/ResendTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()),
Expand Down

0 comments on commit d96d291

Please sign in to comment.