Skip to content

Commit 894b080

Browse files
authored
Merge pull request #179 from Pingu501/ah/send-uploaded-image-as-mail-attachement
BUGFIX: send uploaded images as mail attachments
2 parents fed5813 + c0c67da commit 894b080

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Classes/Finishers/EmailFinisher.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Neos\Form\Core\Model\AbstractFinisher;
1818
use Neos\Form\Exception\FinisherException;
1919
use Neos\SwiftMailer\Message as SwiftMailerMessage;
20+
use Neos\Media\Domain\Model\ResourceBasedInterface;
2021
use Neos\Utility\Arrays;
2122
use Neos\Utility\ObjectAccess;
2223
use Neos\Flow\Annotations as Flow;
@@ -269,6 +270,9 @@ protected function addAttachments(SwiftMailerMessage $mail)
269270
$formValues = $this->finisherContext->getFormValues();
270271
if ($this->parseOption('attachAllPersistentResources')) {
271272
foreach ($formValues as $formValue) {
273+
if ($formValue instanceof ResourceBasedInterface) {
274+
$formValue = $formValue->getResource();
275+
}
272276
if ($formValue instanceof PersistentResource) {
273277
$mail->attach(new \Swift_Attachment(stream_get_contents($formValue->getStream()), $formValue->getFilename(), $formValue->getMediaType()));
274278
}

0 commit comments

Comments
 (0)