#1634 closed task (fixed)
[patch] core.mail does not include a Date header in mails
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Validators | Version: | new-admin |
Severity: | blocker | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
core.mail does not include a "Date" header, leading to mails which land up right at the bottom of my mailbox, which is a bit irritating :)
I can't think of any reason why anybody would want to generate an email without a Date header?
Index: django/core/mail.py =================================================================== --- django/core/mail.py (revision 2694) +++ django/core/mail.py (working copy) @@ -3,6 +3,7 @@ from django.conf import settings from email.MIMEText import MIMEText import smtplib +import time class BadHeaderError(ValueError): pass @@ -46,6 +47,7 @@ msg['Subject'] = subject msg['From'] = from_email msg['To'] = ', '.join(recipient_list) + msg['Date'] = time.strftime('%a, %d %b %Y %H:%M:%S %z') try: server.sendmail(from_email, recipient_list, msg.as_string()) num_sent += 1
Attachments (1)
Change History (8)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Closing for the reason outlined in the comment above. Please reopen if you have a good argument for adding Date headers.
comment:3 by , 18 years ago
priority: | normal → low |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
Version: | magic-removal → SVN |
I get the same problem on debian sarge, python2.3.
Mail sent from my hosting provider's RHEL box does include a Date: header. I suspect the date header is being added by some systems but not others.
Adrian, won't you please help us poor sods who's systems don't add a date header by default?
I'll buy you a beer and/or take you sailing next time you are in San Francisco :)
(Ok, I'll do that whether you use this patch or not)
This approach uses the rfc822 module:
>>> import rfc822 >>> rfc822.formatdate() 'Thu, 25 May 2006 05:40:36 GMT'
See attached patch file
by , 18 years ago
Attachment: | django_core_mail.diff added |
---|
Patch to add RFC 822 Date header to send_mail function
comment:5 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:6 by , 18 years ago
Component: | Core framework → Validators |
---|---|
milestone: | → Version 0.91 |
priority: | low → high |
Severity: | normal → blocker |
Type: | defect → task |
Version: | SVN → new-admin |
Hmm, all the e-mails sent out by
django.core.mail
in my experience have *had* date headers. Is this something the e-mail server takes care of, and some servers don't do it? I believe I've always used sendmail.