aboutsummaryrefslogtreecommitdiffstats
path: root/worker
diff options
context:
space:
mode:
Diffstat (limited to 'worker')
-rw-r--r--worker/jmap/send.go14
-rw-r--r--worker/types/messages.go5
2 files changed, 12 insertions, 7 deletions
diff --git a/worker/jmap/send.go b/worker/jmap/send.go
index 0791419c..757e5420 100644
--- a/worker/jmap/send.go
+++ b/worker/jmap/send.go
@@ -66,6 +66,14 @@ func (w *JMAPWorker) handleStartSend(msg *types.StartSendingMessage) error {
})
}
envelope := &emailsubmission.Envelope{MailFrom: from, RcptTo: rcpts}
+ onSuccess := jmap.Patch{
+ "keywords/$draft": nil,
+ w.rolePatch(mailbox.RoleSent): true,
+ w.rolePatch(mailbox.RoleDrafts): nil,
+ }
+ if copyTo := w.dir2mbox[msg.CopyTo]; copyTo != "" {
+ onSuccess[w.mboxPatch(copyTo)] = true
+ }
// Create the submission
req.Invoke(&emailsubmission.Set{
Account: w.AccountId(),
@@ -77,11 +85,7 @@ func (w *JMAPWorker) handleStartSend(msg *types.StartSendingMessage) error {
},
},
OnSuccessUpdateEmail: map[jmap.ID]jmap.Patch{
- "#sub": {
- "keywords/$draft": nil,
- w.rolePatch(mailbox.RoleSent): true,
- w.rolePatch(mailbox.RoleDrafts): nil,
- },
+ "#sub": onSuccess,
},
})
diff --git a/worker/types/messages.go b/worker/types/messages.go
index 9a2d43f8..3fd018b2 100644
--- a/worker/types/messages.go
+++ b/worker/types/messages.go
@@ -218,8 +218,9 @@ type CheckMail struct {
type StartSendingMessage struct {
Message
- From *mail.Address
- Rcpts []*mail.Address
+ From *mail.Address
+ Rcpts []*mail.Address
+ CopyTo string
}
// Messages