Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#13259 closed (fixed)

multiple calls to message() breaks the mail content

Reported by: canburak Owned by: nobody
Component: Core (Mail) Version: 1.1-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

Description

The message() function from django/core/mail/message.py pop's out From header from extra_headers, so as a side effect, multiple calls to message() generates an email which has the from_email in the From header, instead of the one set in the headers.

As a quick fix, one can reset "From" in extra headers just after calling the message().

Attachments (1)

trac13259.diff (1.8 KB) - added by andialbrecht 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by canburak

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

If this is not a design decision, replacing pop with get will solve the problem.

comment:2 Changed 5 years ago by andialbrecht

IMO replacing pop with get is a good solution. I see no reason why a call to message() should change the extra_headers dictionary.

Changed 5 years ago by andialbrecht

comment:3 Changed 5 years ago by russellm

  • Has patch set
  • milestone set to 1.2
  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [12901]) Fixed #13259 -- Ensure that multiple calls to message() don't corrupt any extra message headers. Thanks to canburak for the report, and Andi Albrecht for the fix.

comment:5 Changed 5 years ago by russellm

(In [12902]) [1.1.X] Fixed #13259 -- Ensure that multiple calls to message() don't corrupt any extra message headers. Thanks to canburak for the report, and Andi Albrecht for the fix.

Backport of r12901 from trunk.

comment:6 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top