Skip to content

Commit 72e0a0b

Browse files
authored
Add support for sending raw (non-encoded) attachments in Resend mail (#55837)
* Add support for sending raw (non-encoded) attachments in Resend mail driver * Style fix
1 parent 382a6d5 commit 72e0a0b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Illuminate/Mail/Transport/ResendTransport.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,19 @@ protected function doSend(SentMessage $message): void
7272
if ($email->getAttachments()) {
7373
foreach ($email->getAttachments() as $attachment) {
7474
$attachmentHeaders = $attachment->getPreparedHeaders();
75+
$contentType = $attachmentHeaders->get('Content-Type')->getBody();
7576

7677
$filename = $attachmentHeaders->getHeaderParameter('Content-Disposition', 'filename');
7778

79+
if ($contentType == 'text/calendar') {
80+
$content = $attachment->getBody();
81+
} else {
82+
$content = str_replace("\r\n", '', $attachment->bodyToString());
83+
}
84+
7885
$item = [
79-
'content_type' => $attachmentHeaders->get('Content-Type')->getBody(),
80-
'content' => str_replace("\r\n", '', $attachment->bodyToString()),
86+
'content_type' => $contentType,
87+
'content' => $content,
8188
'filename' => $filename,
8289
];
8390

0 commit comments

Comments
 (0)