Hi people,
I am currently maintaining a website where at times I may need to send around 10,000+ emails at a time.
I just want to ask on what methods you may consider Django best practices e.g. in efficiency when sending mail to a list of this size?
I am currently handling this as a celery task and sending the emails through Mandrill transactional email service
Currently, this is how I am handling it:
from django.core.mail import EmailMultiAlternatives, get_connection
from models import Subscriber
connection = get_connection()
recipients
= [i.email for i in Subscriber.objects.all()]
for sub in subscribers:
msg = EmailMultiAlternatives(title, content, sender, [sub])
msg.attach_alternative(content, "text/html")
recipient_list.append(msg)
connection.send_messages(recipients)
Is it better to split the list into smaller chinks to reduce the size of the requests or which other implementation methods can I consider?
Thanks
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/16702abe-7923-4cf7-b51d-15fb19438d6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment