Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2991: Added Message-ID header to messages sent from Django. Th…

…anks, Graham King.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4051 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6f164ad4856a1a5431b3b3e19ab6dbafe692a52d 1 parent b1b4e8e
Jacob Kaplan-Moss authored November 07, 2006

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  django/core/mail.py
4  django/core/mail.py
@@ -4,6 +4,9 @@
4 4
 from email.MIMEText import MIMEText
5 5
 from email.Header import Header
6 6
 import smtplib, rfc822
  7
+import socket
  8
+import time
  9
+import random
7 10
 
8 11
 class BadHeaderError(ValueError):
9 12
     pass
@@ -50,6 +53,7 @@ def send_mass_mail(datatuple, fail_silently=False, auth_user=settings.EMAIL_HOST
50 53
         msg['From'] = from_email
51 54
         msg['To'] = ', '.join(recipient_list)
52 55
         msg['Date'] = rfc822.formatdate()
  56
+        msg['Message-ID'] = "<%d.%d@%s>" % ( time.time(), random.getrandbits(64), socket.getfqdn() )
53 57
         try:
54 58
             server.sendmail(from_email, recipient_list, msg.as_string())
55 59
             num_sent += 1

0 notes on commit 6f164ad

Please sign in to comment.
Something went wrong with that request. Please try again.