send asynchronous closed e-mails to django

As suggested in the comments you need to implement a task queue and worker. In my projects I use django-rq and Redis.

See the repo here: https://github.com/rq/django-rq

Then you can push the send_mail function into the queue as shown in the example:

import django_rq

# process stuff here

# queue the email for sending
django_rq.enqueue(send_mail, subject, plain_message, from_email, [order.customer.email], html_message=html_message)

But make sure that you’ll need to also have a worker in the background to actually process the items in the queue.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top