Skip to content

Commit

Permalink
Ability to define attachment filename
Browse files Browse the repository at this point in the history
  • Loading branch information
adpeyre authored and Adrien Peyre committed Jun 10, 2022
1 parent 949e256 commit 93c4ceb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Bundle/Sender/Adapter/SwiftMailerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public function send(

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

foreach ($attachments as $attachment) {
$file = \Swift_Attachment::fromPath($attachment);

foreach ($attachments as $attachmentFilename => $attachmentPath) {
$file = \Swift_Attachment::fromPath($attachmentPath);
if (is_string($attachmentFilename)) {
$file->setFilename($attachmentFilename);
}
$message->attach($file);
}

Expand Down

0 comments on commit 93c4ceb

Please sign in to comment.