Skip to content

Commit 29ccce8

Browse files
committed
Update Emails.php
1 parent 4451605 commit 29ccce8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Resources/Emails.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,22 @@ protected function prepareEmail(): array
274274

275275
$attachmentArray = [];
276276
foreach ($attachments as $file) {
277+
if (array_key_exists('name', $file) && array_key_exists('contentBytes', $file)) {
278+
$attachmentArray[] = [
279+
'@odata.type' => '#microsoft.graph.fileAttachment',
280+
'name' => $file['name'],
281+
'contentBytes' => $file['contentBytes'],
282+
];
283+
} else {
277284
$path = pathinfo($file);
278285

279286
$attachmentArray[] = [
280-
'@odata.type' => '#microsoft.graph.fileAttachment',
281-
'name' => $path['basename'],
282-
'contentType' => mime_content_type($file),
283-
'contentBytes' => base64_encode(file_get_contents($file)),
287+
'@odata.type' => '#microsoft.graph.fileAttachment',
288+
'name' => $path['basename'],
289+
'contentType' => mime_content_type($file),
290+
'contentBytes' => base64_encode(file_get_contents($file)),
284291
];
292+
}
285293
}
286294

287295
$singleValueExtendedPropertiesarray = [];

0 commit comments

Comments
 (0)