Ticket #17862: patch_send_mail.diff

File patch_send_mail.diff, 1.7 KB (added by karthikabinav, 13 years ago)

Changed the send_mail to EmailMessage in contrib/auth

  • django/contrib/auth/forms.py

    diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
    index badd760..460c7d5 100644
    a b class PasswordResetForm(forms.Form):  
    214214        Generates a one-use only link for resetting password and sends to the
    215215        user.
    216216        """
    217         from django.core.mail import send_mail
     217        from django.core.mail import EmailMessage
    218218        for user in self.users_cache:
    219219            if not domain_override:
    220220                current_site = get_current_site(request)
    class PasswordResetForm(forms.Form):  
    235235            # Email subject *must not* contain newlines
    236236            subject = ''.join(subject.splitlines())
    237237            email = loader.render_to_string(email_template_name, c)
    238             send_mail(subject, email, from_email, [user.email])
     238            EmailMessage(subject, email, from_email, [user.email]).send()
    239239
    240240
    241241class SetPasswordForm(forms.Form):
  • django/contrib/auth/models.py

    diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
    index 571bf79..b0fdab9 100644
    a b  
    11import urllib
    22
    33from django.core.exceptions import ImproperlyConfigured
    4 from django.core.mail import send_mail
     4from django.core.mail import EmailMessage
    55from django.db import models
    66from django.db.models.manager import EmptyManager
    77from django.utils.crypto import get_random_string
    class User(models.Model):  
    363363        """
    364364        Sends an email to this User.
    365365        """
    366         send_mail(subject, message, from_email, [self.email])
     366        EmailMessage(subject, message, from_email, [self.email]).send()
    367367
    368368    def get_profile(self):
    369369        """
Back to Top