2👍
✅
The easiest thing is to queue the email messages and then have them sent by a daemon. Check out django-mailer.
Since you only seem to be concerned with send_mail, you can get started with two steps. First, use this to import django-mailer’s version of send_mail:
# favour django-mailer but fall back to django.core.mail
from django.conf import settings
if "mailer" in settings.INSTALLED_APPS:
from mailer import send_mail
else:
from django.core.mail import send_mail
And then create a cronjob that calls manage.py send_mail
to send the mail. Check the django-mailer usage docs for example cronjob entries.
If you are not seeing any email get sent, try running manage.py send_mail
on the console. This seems to be the number one problem people have.
3👍
To avoid a delay to the response, you want to do this asynchronously in another process.
This question is about how to handle that: Advice on Python/Django and message queues
- [Django]-Django ImportError at / no matter what I do
- [Django]-Django i18n: makemessages only on site level possible?
- [Django]-How can i write the initial data for django 1.8
Source:stackexchange.com