fix: move draft to sent and clear draft flag on submission
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -1007,11 +1007,14 @@ class RemoteMailService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit an existing draft message.
|
||||
* Submit an existing draft message. On success, the draft Email is moved
|
||||
* from the drafts mailbox to the sent mailbox and its \Draft keyword is
|
||||
* cleared in the same request, so the submitted draft becomes the sent
|
||||
* copy rather than lingering as an unsent draft.
|
||||
*
|
||||
* @since Release 2.0.0
|
||||
*/
|
||||
public function entitySubmitDraft(string $identityId, string $draftId, ?array $patch = null, array $attachments = []): string {
|
||||
public function entitySubmitDraft(string $identityId, string $draftId, string $preSendTarget, string $postSentTarget, ?array $patch = null, array $attachments = []): string {
|
||||
if ($draftId === '') {
|
||||
throw new Exception('Draft identifier is required for draft submission', 1);
|
||||
}
|
||||
@@ -1029,6 +1032,11 @@ class RemoteMailService {
|
||||
|
||||
$submissionId = 's_' . uniqid();
|
||||
$r1 = new MailSubmissionSet($this->dataAccount, null, $this->resourceNamespace, $this->resourceEntityLabel);
|
||||
$r1->completionUpdate($draftId, [
|
||||
'mailboxIds/' . $postSentTarget => true,
|
||||
'mailboxIds/' . $preSendTarget => null,
|
||||
'keywords/$draft' => null,
|
||||
]);
|
||||
$s0 = $r1->create($submissionId);
|
||||
$s0->identity($identityId);
|
||||
$s0->message($draftId);
|
||||
|
||||
Reference in New Issue
Block a user