Ticket #3007: messageid.patch
File messageid.patch, 991 bytes (added by , 18 years ago) |
---|
-
django/core/mail.py
8 8 import time 9 9 import random 10 10 11 # Cache the hostname 12 DNS_NAME = socket.getfqdn() 13 11 14 class BadHeaderError(ValueError): 12 15 pass 13 16 … … 53 56 msg['From'] = from_email 54 57 msg['To'] = ', '.join(recipient_list) 55 58 msg['Date'] = rfc822.formatdate() 56 msg['Message-ID'] = "<%d.%d@%s>" % (time.time(), random.getrandbits(64), socket.getfqdn())57 59 try: 60 random_bits = str(random.getrandbits(64)) 61 except AttributeError: # Python 2.3 fallback 62 random_bits = ''.join([random.choice('1234567890') for i in range(19)]) 63 msg['Message-ID'] = '<%d.%s@%s>' % (time.time(), random_bits, DNS_NAME) 64 try: 58 65 server.sendmail(from_email, recipient_list, msg.as_string()) 59 66 num_sent += 1 60 67 except: