Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Reply drafts saved to the IMAP Drafts mailbox lose In-Reply-To and References

Aperta Adatta ai principianti
#13,950 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Leggi lib/IMAP/ImapTransmissionConnector.php, concentrandoti su saveMessage() e sulla gestione esistente delle intestazioni in sendMessage(). Aggiungi le intestazioni di risposta quando salvi le bozze, poi controlla nella sorgente della bozza la presenza di In-Reply-To e References; l’issue indica anche startComposerSession per verificare che le bozze riaperte mantengano la relazione di risposta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

1. to develop bug
Describe the bug

When a reply is saved as a draft and moved to the IMAP Drafts mailbox, the stored message has no In-Reply-To and no References header, although the local draft knows the message it replies to (inReplyToMessageId).

The headers are only written on the send path. ImapTransmissionConnector::sendMessage() adds them:

if (($inReplyTo = $message->getInReplyToMessageId()) !== null) {
    $fccHeaders->addHeader('References', $inReplyTo);
    $fccHeaders->addHeader('In-Reply-To', $inReplyTo);
}

ImapTransmissionConnector::saveMessage(), which DraftsService::sendMessage() uses to store a draft in the Drafts mailbox, builds its own header set (Date, Message-ID, From, To, Cc, Bcc, Subject) and does not include them.

Consequences
  1. Reopening a reply draft in Mail. When the composer is closed, the draft is moved to IMAP (moveDraft). Reopening it from the Drafts mailbox goes through the templateMessageId branch of startComposerSession, which does not restore inReplyToMessageId either. Sending it then produces a reply without In-Reply-To/References.
  2. Finishing a reply draft in another client (Thunderbird, Outlook, Apple Mail, mobile) via the shared IMAP Drafts folder. The other client sends the draft as stored, so the reply is not linked to the original.
  3. Drafts created through the API (POST /api/drafts with inReplyToMessageId, then POST /api/drafts/move/{id}) are affected in the same way.

Replying and sending in one composer session works, because that goes through the outbox/send path.

Recipients' clients that thread by these headers (Thunderbird, Gmail, Apple Mail) show such a reply outside the conversation, and the sender's own original is not flagged as answered.

Steps to reproduce
  1. Open a received message and click Reply.
  2. Type some text and close the composer, so the draft is saved to the Drafts mailbox.
  3. View the source of the draft in the Drafts mailbox: no In-Reply-To, no References.
  4. Reopen the draft in Mail (or in any other IMAP client) and send it.
  5. View the source of the sent message: no In-Reply-To, no References.

Alternatively via API: POST /apps/mail/api/drafts with inReplyToMessageId set, then POST /apps/mail/api/drafts/move/{id}, then GET /apps/mail/api/messages/{id}/source for the message in the Drafts mailbox.

Expected behavior

The draft stored in the Drafts mailbox carries In-Reply-To and References, like the sent copy does, so the reply relation survives closing the composer and switching clients.

Suggested fix

Add the same block to saveMessage() in lib/IMAP/ImapTransmissionConnector.php, after the Subject header:

if (($inReplyTo = $message->getInReplyToMessageId()) !== null) {
    $headers->addHeader('References', $inReplyTo);
    $headers->addHeader('In-Reply-To', $inReplyTo);
}

For consequence 1, the templateMessageId branch of startComposerSession could additionally take inReplyToMessageId from the fetched message's inReplyTo, so that a reopened draft keeps the relation when sent from Mail.

Environment
  • Nextcloud server 33.0.9
  • Mail app: code paths checked against current main on 2026-10-27
  • IMAP account with a regular Drafts mailbox
Lingua principale
JavaScript
Stelle
1.1k
Fork
373
Merge medio
1g 11h
PR unite (30g)
91

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextcloud/mail

Tutte le issue di nextcloud/mail

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.