#28189: Sending emails asynchronous
-------------------------------------+-------------------------------------
               Reporter:  Stijn      |          Owner:  nobody
  Goethals                           |
                   Type:  New        |         Status:  new
  feature                            |
              Component:             |        Version:
  contrib.auth                       |       Keywords:  Password reset;
               Severity:  Normal     |  Threading; emails; mail;
           Triage Stage:             |  asynchronous;
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  1
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Sending the password reset e-mail asynchronous will improve the page load
 time very hard. This an nice feature for in an production environment.

 I think that the best strategy is to add an variable to the setting file
 an then check if this variable is enabled. We could use this code:

 {{{
         EMAIL_ASYNC_MAIL = getattr(settings, 'EMAIL_ASYNC_MAIL', False)


         if EMAIL_ASYNC_MAIL:
             thread = Thread(target=self.send_mail,
                                          args=(subject_template_name,
 email_template_name, context, from_email, user.email),
 kwargs={"html_email_template_name":html_email_template_name})
             thread.start()
 }}}

 An other option is adding sending asynchronous mail to django.core.mail.

--
Ticket URL: <https://code.djangoproject.com/ticket/28189>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/054.0a65b3c2aed767e7a65a385abb466bc1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to