generated from Nodarx/template
fix: delete superseded draft UID after sending via SMTP
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -675,10 +675,27 @@ class Service implements ServiceBaseInterface, ServiceMutableInterface, ServiceC
|
||||
// ignore — the message was already delivered
|
||||
}
|
||||
|
||||
// Best-effort: IMAP has no native "submit existing draft" operation, so the
|
||||
// message above was always sent fresh. If it originated from a synced draft,
|
||||
// remove the now-superseded draft UID. A failure here must not turn a
|
||||
// successful delivery into an error; the draft is simply left for a later
|
||||
// discard or retry.
|
||||
if ($source !== null
|
||||
&& $source->provider() === $this->provider()
|
||||
&& $source->service() === $this->identifier()) {
|
||||
try {
|
||||
$this->initialize();
|
||||
$this->remoteService->entityDestroy($source->collection(), (int) $source->entity());
|
||||
} catch (\Throwable) {
|
||||
// ignore — the message was already delivered
|
||||
}
|
||||
}
|
||||
|
||||
return new EntitySubmitResult(
|
||||
disposition: EntitySubmitResult::DISPOSITION_SENT,
|
||||
transportId: $queueId !== '' ? $queueId : null,
|
||||
sentEntity: $sentEntity,
|
||||
sourceDraft: $source instanceof EntityIdentifier ? $source : null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user