Ticket #3605: mail.py.patch

File mail.py.patch, 1.8 KB (added by msaelices@…, 18 years ago)
  • mail.py

     
    3434            val = Header(val, settings.DEFAULT_CHARSET)
    3535        MIMEText.__setitem__(self, name, val)
    3636
    37 def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None):
     37def send_mail(subject, message, from_email, recipient_list, fail_silently=False, auth_user=None, auth_password=None, subtype='plain'):
    3838    """
    3939    Easy wrapper for sending a single message to a recipient list. All members
    4040    of the recipient list will see the other recipients in the 'To' field.
     
    4646        auth_user = settings.EMAIL_HOST_USER
    4747    if auth_password is None:
    4848        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)
    5050
    51 def send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None):
     51def send_mass_mail(datatuple, fail_silently=False, auth_user=None, auth_password=None, subtype='plain'):
    5252    """
    5353    Given a datatuple of (subject, message, from_email, recipient_list), sends
    5454    each message to each recipient list. Returns the number of e-mails sent.
     
    7575        if not recipient_list:
    7676            continue
    7777        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)
    7979        msg['Subject'] = subject
    8080        msg['From'] = from_email
    8181        msg['To'] = ', '.join(recipient_list)
Back to Top