Skip to content

Commit

Permalink
Internal: Allow to attach file in mail from stream - refs BT#21648
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed May 27, 2024
1 parent 8472948 commit 112d4e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/CoreBundle/ServiceHelper/MailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\BodyRendererInterface;
use Symfony\Component\Mime\Part\DataPart;

final class MailHelper
{
Expand Down Expand Up @@ -77,6 +78,10 @@ public function send(
if (!empty($file_attach['path']) && !empty($file_attach['filename'])) {
$templatedEmail->attachFromPath($file_attach['path'], $file_attach['filename']);
}

if (!empty($file_attach['stream']) && !empty($file_attach['filename'])) {
$templatedEmail->addPart(new DataPart($file_attach['stream'], $file_attach['filename']));
}
}
}

Expand Down

0 comments on commit 112d4e6

Please sign in to comment.