fix(smtp): keep a copy of every submitted message in the sender's Sent folder
A message sent over SMTP submission was delivered but left nothing behind: the account's Sent folder stayed empty. Webmail files its own copy after sending, and a mail client cannot do it either, since IMAP APPEND is not implemented, so nothing ever filled Sent for SMTP clients. - ProcessOutboundEmailInput.FileSentCopy asks Submit to file the signed message in the sender's Sent folder, as read (not unread), sharing the blob the delivery jobs already reference; one copy per submission, not per recipient - the SMTP submission session sets it; the webmail leaves it off because it files its own copy without the Bcc line, and asking twice would duplicate it - filed only after the message is durably queued, so a submission refused by the send limit leaves nothing behind; a failure to file is logged, never returned, because the mail is already on its way and the client would send it again Tests: unit cases (asked/not asked, shared blob, failure swallowed, limit refusal, no repository) and an end-to-end test on the real submission server that fails with "Sent holds 0 messages" without the fix. Full go test ./... (25 packages) with TEST_DATABASE_URL, go vet and lang-lint are clean.
This commit is contained in:
1 parent
110a240cd9
commit
9c8b9c00fc
5 files changed
+323
No files matched your search
@@ -122,6 +122,8 @@ func (s *submissionSession) Data(r io.Reader) error {
|
||||
Recipients: s.recipients,
|
||||
Body: r,
|
||||
MaxRecipientsPerHour: s.authenticated.MaxRecipientsPerHour,
|
||||
// A client cannot file its own copy over IMAP, so the server keeps it
|
||||
FileSentCopy: true,
|
||||
})
|
||||
if err == nil {
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user