[18.0] mail_composer_cc_bcc: re-sending a composer email duplicates the Cc recipient and loses the agreed To / Cc headers

Aperta
#268 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start by reading mail_composer_cc_bcc’s MailMail._prepare_outgoing_list() and trace how composer sends set is_from_composer versus how retry and queue sends prepare outgoing messages. Add focused tests covering retry of a failed composer email with To, Cc, and Bcc recipients; done means retry sends exactly three emails and preserves the expected To/Cc headers without duplicating the Cc recipient.

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

Descrizione

Module: mail_composer_cc_bcc 18.0.1.0.3
Odoo: 18.0 Community, image odoo:18 build 18.0-20260908, clean database, module only

Summary

MailMail._prepare_outgoing_list() returns early unless self.env.context["is_from_composer"] is
set. That key only exists while the composer is sending; the mail.mail outlives it and is
re-sent without it by the standard Retry button of Settings > Technical > Emails
(mark_outgoing() + process_email_queue()), by the queue cron, or by a resend wizard. Those
sends fall back to core, so the two things the module does on purpose are lost:

  • the Cc-only email core builds when mail.email_to is empty is no longer dropped, so the Cc
    recipient receives two copies;
  • every email gets core's per-recipient To instead of the To / Cc pair the composer agreed on.
Steps to reproduce
  1. Clean 18.0 database, install mail_composer_cc_bcc only.
  2. Create partners TO, CC, BCC, all with an email.
  3. Compose a message on any record from the composer with those three in To, Cc and Bcc.
  4. Make the send fail (stop the SMTP server), so the mail.mail ends in exception.
  5. Settings > Technical > Emails > select it > Retry, then run the email queue.

Observed: 4 emails for 3 recipients:

   #1 To=''                              Cc='"Rcpt CC" <[email protected]>'  RCPT TO=['[email protected]']
   #2 To='"Rcpt BCC" <[email protected]>'  Cc=None                          RCPT TO=['[email protected]']
   #3 To='"Rcpt CC" <[email protected]>'    Cc=None                          RCPT TO=['[email protected]']
   #4 To='"Rcpt TO" <[email protected]>'    Cc=None                          RCPT TO=['[email protected]']

Expected: the same 3 emails the composer sends, with the same To / Cc headers.

Note on 19.0

On 19.0 the same root cause is worse: core stores an X-Msg-To-Add header on the mail.mail
listing every external recipient (Bcc partners included) and merges it into To at send time, so
the retry discloses the blind copies. That header does not exist on 18.0, which is why this issue
is only about the duplicate and the headers.

Suggested fix

Do not key the behaviour on the context: persist on the mail.mail that it was built with this
module's Cc / Bcc handling and read that in _prepare_outgoing_list().

Lingua principale
Python
Stelle
36
Fork
180
Merge medio
4g 2h
PR unite (30g)
14

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 OCA/mail

Tutte le issue di OCA/mail

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.