Skip to content

Commit 33ee665

Browse files
adpeyreAdrien Peyre
authored andcommitted
Ability to define attachment filename
1 parent 949e256 commit 33ee665

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
@@ -64,9 +64,11 @@ public function send(
6464

6565
$message->setBody($renderedEmail->getBody(), 'text/html');
6666

67-
foreach ($attachments as $attachment) {
68-
$file = \Swift_Attachment::fromPath($attachment);
69-
67+
foreach ($attachments as $attachmentFilename => $attachmentPath) {
68+
$file = \Swift_Attachment::fromPath($attachmentPath);
69+
if (!is_numeric($attachmentFilename)) {
70+
$file->setFilename($attachmentFilename);
71+
}
7072
$message->attach($file);
7173
}
7274

0 commit comments

Comments
 (0)