Python / Django:在后台发送电子邮件 [英] Python/Django: sending emails in the background

查看:128
本文介绍了Python / Django:在后台发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一下,用户在网站上执行操作并通知管理员的情况。
想象一下,有20个管理员通知。通过使用Django发送电子邮件的正常方法,用户必须等待所有电子邮件发送才能继续。

Imagine a situation in which a user performs an action on a website and admins are notified. Imagine there are 20 admins to notify. By using normal methods for sending emails with Django the user will have to wait until all the emails are sent before being able to proceed.

如何发送所有电子邮件一个单独的过程,所以用户不必等待?是否可能?

How can I send all the emails in a separate process so the user doesn't have to wait? Is it possible?

推荐答案

使用芹菜作为任务队列, django-celery-email 是一个Django电子邮件后端,将邮件发送到芹菜任务。

Use celery as a task queue and django-celery-email which is an Django e-mail backend that dispatches e-mail sending to a celery task.

这篇关于Python / Django:在后台发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆