Django

Code

Ticket #9233 (closed: fixed)

Opened 2 months ago

Last modified 2 months ago

EmailMessage.message() duplicates data from extra_headers

Reported by: kostaz Assigned to: nobody
Milestone: post-1.0 Component: django.core.mail
Version: 1.0 Keywords:
Cc: densetsu.no.ero.sennin@gmail.com, nreilly@nreilly.com Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

If I have "Date" and "Message-ID" in extra_headers, the message() method of the EmailMessage? will first create default ones and then add the ones specified in the extra_headers, thus creating duplicates. A proposed solution to this is to check if they were specified in extra_headers and use those, instead of creating default ones.

i.e.

if not 'Date' in self.extra_headers: 
    msg['Date'] = formatdate()
if not 'Message-ID' in self.extra_headers:
    msg['Message-ID'] = make_msgid()

Attachments

Change History

09/29/08 16:00:33 changed by EroSennin

  • cc set to densetsu.no.ero.sennin@gmail.com.
  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

10/06/08 22:49:55 changed by anonymous

  • cc changed from densetsu.no.ero.sennin@gmail.com to densetsu.no.ero.sennin@gmail.com, nreilly@nreilly.com.

10/07/08 07:21:37 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in r9197.

10/07/08 07:26:01 changed by mtredinnick

(In [9198]) [1.0.X] Fixed #9233 -- Allow date and message-id headers to be passed in manually in email messages. Previously we were creating duplicate headers, which was bad.

Backport of r9197 from trunk. I'm calling this a bugfix, since the docs are unclear about which headers you can pass into an EmailMessage? constructor.


Add/Change #9233 (EmailMessage.message() duplicates data from extra_headers)




Change Properties
Action