Ticket #3605: mail.py.patch
File mail.py.patch, 1.8 KB (added by , 18 years ago) |
---|
-
mail.py
34 34 val = Header(val, settings.DEFAULT_CHARSET) 35 35 MIMEText.__setitem__(self, name, val) 36 36 37 def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None ):37 def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None, subtype='plain'): 38 38 """ 39 39 Easy wrapper for sending a single message to a recipient list. All members 40 40 of the recipient list will see the other recipients in the 'To' field. … … 46 46 auth_user = settings.EMAIL_HOST_USER 47 47 if auth_password is None: 48 48 auth_password = settings.EMAIL_HOST_PASSWORD 49 return send_mass_mail([[subject, message, from_email, recipient_list]], fail_silently, auth_user, auth_password )49 return send_mass_mail([[subject, message, from_email, recipient_list]], fail_silently, auth_user, auth_password, subtype) 50 50 51 def send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None ):51 def send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None, subtype='plain'): 52 52 """ 53 53 Given a datatuple of (subject, message, from_email, recipient_list), sends 54 54 each message to each recipient list. Returns the number of e-mails sent. … … 75 75 if not recipient_list: 76 76 continue 77 77 from_email = from_email or settings.DEFAULT_FROM_EMAIL 78 msg = SafeMIMEText(message, 'plain', settings.DEFAULT_CHARSET)78 msg = SafeMIMEText(message, subtype, settings.DEFAULT_CHARSET) 79 79 msg['Subject'] = subject 80 80 msg['From'] = from_email 81 81 msg['To'] = ', '.join(recipient_list)