From 6f164ad4856a1a5431b3b3e19ab6dbafe692a52d Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 7 Nov 2006 15:32:18 +0000 Subject: [PATCH] Fixed #2991: Added Message-ID header to messages sent from Django. Thanks, Graham King. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4051 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/mail.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django/core/mail.py b/django/core/mail.py index da4cacbe29..0f607136d8 100644 --- a/django/core/mail.py +++ b/django/core/mail.py @@ -4,6 +4,9 @@ from django.conf import settings from email.MIMEText import MIMEText from email.Header import Header import smtplib, rfc822 +import socket +import time +import random class BadHeaderError(ValueError): pass @@ -50,6 +53,7 @@ def send_mass_mail(datatuple, fail_silently=False, auth_user=settings.EMAIL_HOST msg['From'] = from_email msg['To'] = ', '.join(recipient_list) msg['Date'] = rfc822.formatdate() + msg['Message-ID'] = "<%d.%d@%s>" % ( time.time(), random.getrandbits(64), socket.getfqdn() ) try: server.sendmail(from_email, recipient_list, msg.as_string()) num_sent += 1