一句话:太TM省事儿了!

from django.core.mail import send_mail

send_mail(
    'Subject here',
    'Here is the message.',
    'from@example.com',
    ['to@example.com'],
    fail_silently=False,
)

别忘了在配置文件设置smtp服务器名、端口、用户名和密码。

官网文档:https://docs.djangoproject.com/en/2.1/topics/email/

posted on 2018-11-08 16:51  蛋尼  阅读(86)  评论(0编辑  收藏  举报