Forked from rfj001/allauth_background_email_adapter
Created
February 21, 2017 11:30
-
-
Save Yogendra0Sharma/c9da569ce77a70293a2c13c8d78e3ebc to your computer and use it in GitHub Desktop.
Avoid noticeable page-load slowdown when sending emails with django-allauth by sending email in background
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
from allauth.account.adapter import DefaultAccountAdapter | |
class BackgroundEmailSendingAccountAdapter(DefaultAccountAdapter): | |
def send_mail(self, template_prefix, email, context): | |
mailing_thread = threading.Thread( | |
target=super(BackgroundEmailSendingAccountAdapter, self).send_mail, | |
args=(template_prefix, email, context) | |
) | |
mailing_thread.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment