Opened 9 years ago
Closed 9 years ago
#28189 closed New feature (duplicate)
Sending emails asynchronous
| Reported by: | Stijn Goethals | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.auth | Version: | |
| Severity: | Normal | Keywords: | Password reset; Threading; emails; mail; asynchronous; |
| Cc: | stijn_goethals@… | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
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.
Note:
See TracTickets
for help on using tickets.
Duplicate (more or less) of #19214. If you' like to revisit the wontfix decision, post to the DevelopersMailingList explaining why you think the wontfix isn't warranted.