【发布时间】:2015-05-30 04:17:01
【问题描述】:
有没有办法通过 python 应用程序(Flask 或 Django)发送预定的电子邮件?到目前为止,我使用了 gmail 和 smtplib,但据我所知,在那里无法进行调度。还有其他(更好的)方法吗?
【问题讨论】:
-
cron/ Windows task scheduler 可能是“更好的方法”
标签: python django email flask smtp
有没有办法通过 python 应用程序(Flask 或 Django)发送预定的电子邮件?到目前为止,我使用了 gmail 和 smtplib,但据我所知,在那里无法进行调度。还有其他(更好的)方法吗?
【问题讨论】:
cron / Windows task scheduler 可能是“更好的方法”
标签: python django email flask smtp
您需要一个专门用于此任务的进程。
一个常见的答案是使用 RabbitMQ 和 Celery,例如:https://simpleisbetterthancomplex.com/tutorial/2017/08/20/how-to-use-celery-with-django.html
您还可以使用其他队列,例如 Redis 队列:http://python-rq.org/ 和配套工具:https://github.com/ui/rq-scheduler 来获得类似 cron 的功能
【讨论】:
mathematism的链接,它只是显示图片