Ticket #2991: django-mail-message-id.diff

File django-mail-message-id.diff, 703 bytes (added by Graham King <graham@…>, 18 years ago)

svn diff

  • mail.py

     
    44from email.MIMEText import MIMEText
    55from email.Header import Header
    66import smtplib, rfc822
     7import socket
     8import time
     9import random
    710
    811class BadHeaderError(ValueError):
    912    pass
     
    5053        msg['From'] = from_email
    5154        msg['To'] = ', '.join(recipient_list)
    5255        msg['Date'] = rfc822.formatdate()
     56        msg['Message-ID'] = "<%d.%d@%s>" % ( time.time(), random.getrandbits(64), socket.getfqdn() )
    5357        try:
    5458            server.sendmail(from_email, recipient_list, msg.as_string())
    5559            num_sent += 1
Back to Top