fix: attachment upload on send
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -880,7 +880,31 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
);
|
||||
}
|
||||
|
||||
$nativeMessage = $this->normalizeMessageProperties($message)->toJmap();
|
||||
$nativeProperties = $this->normalizeMessageProperties($message);
|
||||
$attachments = $nativeProperties->getAttachments();
|
||||
foreach ($attachments as $attachment) {
|
||||
if ($attachment->getBlobId() !== null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$content = $attachment->getContent();
|
||||
if ($content === null) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Attachment "%s" has neither content nor a JMAP blob identifier',
|
||||
$attachment->getName() ?? 'unnamed',
|
||||
));
|
||||
}
|
||||
|
||||
$attachment->setBlobId($this->mailService->blobDeposit(
|
||||
$attachment->getType() ?? 'application/octet-stream',
|
||||
$content,
|
||||
));
|
||||
}
|
||||
if ($attachments !== []) {
|
||||
$nativeProperties->setAttachments(...$attachments);
|
||||
}
|
||||
|
||||
$nativeMessage = $nativeProperties->toJmap();
|
||||
$transportId = $this->mailService->entitySubmitFresh($identityId, $nativeMessage, $preSendTarget->collection(), $postSentTarget->collection());
|
||||
|
||||
return new EntitySubmitResult(
|
||||
|
||||
Reference in New Issue
Block a user