Skip to content

Commit 8d46ad4

Browse files
authored
Ability to define attachment filename
1 parent ac1af41 commit 8d46ad4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Bundle/Sender/Adapter/SwiftMailerAdapter.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ public function send(
5555

5656
$message->setBody($renderedEmail->getBody(), 'text/html');
5757

58-
foreach ($attachments as $attachment) {
59-
$file = \Swift_Attachment::fromPath($attachment);
60-
58+
foreach ($attachments as $attachmentFilename => $attachmentPath) {
59+
$file = \Swift_Attachment::fromPath($attachmentPath);
60+
if (!is_numeric($attachmentFilename)) {
61+
$file->setFilename($attachmentFilename);
62+
}
6163
$message->attach($file);
6264
}
6365

0 commit comments

Comments
 (0)