From da126cce5a78de4962124c08da246628080b3342 Mon Sep 17 00:00:00 2001 From: Roy Wulms Date: Fri, 23 May 2025 08:49:57 +0200 Subject: [PATCH 1/2] Add support for sending raw (non-encoded) attachments in Resend mail driver --- src/Illuminate/Mail/Transport/ResendTransport.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Mail/Transport/ResendTransport.php b/src/Illuminate/Mail/Transport/ResendTransport.php index 0e690bf30b5a..f9fd2723bb37 100644 --- a/src/Illuminate/Mail/Transport/ResendTransport.php +++ b/src/Illuminate/Mail/Transport/ResendTransport.php @@ -72,12 +72,19 @@ protected function doSend(SentMessage $message): void if ($email->getAttachments()) { foreach ($email->getAttachments() as $attachment) { $attachmentHeaders = $attachment->getPreparedHeaders(); + $contentType = $attachmentHeaders->get('Content-Type')->getBody(); $filename = $attachmentHeaders->getHeaderParameter('Content-Disposition', 'filename'); + if($contentType == 'text/calendar') { + $content = $attachment->getBody(); + } else { + $content = str_replace("\r\n", '', $attachment->bodyToString()); + } + $item = [ - 'content_type' => $attachmentHeaders->get('Content-Type')->getBody(), - 'content' => str_replace("\r\n", '', $attachment->bodyToString()), + 'content_type' => $contentType, + 'content' => $content, 'filename' => $filename, ]; From 7ff007aa72765b1647d30fc78e57e8eb0be7c85b Mon Sep 17 00:00:00 2001 From: Roy Wulms Date: Fri, 23 May 2025 08:53:45 +0200 Subject: [PATCH 2/2] Style fix --- src/Illuminate/Mail/Transport/ResendTransport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Mail/Transport/ResendTransport.php b/src/Illuminate/Mail/Transport/ResendTransport.php index f9fd2723bb37..9693eaf3a476 100644 --- a/src/Illuminate/Mail/Transport/ResendTransport.php +++ b/src/Illuminate/Mail/Transport/ResendTransport.php @@ -76,7 +76,7 @@ protected function doSend(SentMessage $message): void $filename = $attachmentHeaders->getHeaderParameter('Content-Disposition', 'filename'); - if($contentType == 'text/calendar') { + if ($contentType == 'text/calendar') { $content = $attachment->getBody(); } else { $content = str_replace("\r\n", '', $attachment->bodyToString());