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
This commit is contained in:
parent
b1b4e8e7c4
commit
6f164ad485
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue