Answer the question
In order to leave comments, you need to log in
Django, what's the easiest way to send an email asynchronously?
Good afternoon, is it possible to send a letter without saleri? If yes, how? With what library? Or post links to articles. Thanks in advance)
Answer the question
In order to leave comments, you need to log in
The simplest is to run the mail sending function in a separate thread:
from threading import Thread
from django.core.mail import send_mail
Thread(target=send_mail, args=(subject, txt_msg_body, settings.DEFAULT_FROM_EMAIL, smtp_to),
kwargs={'fail_silently': (not settings.DEBUG), 'html_message': html_msg_body}).start()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question