Python——Django框架——邮件

#引用EMAIL服务
EMAIL_BACKEND = 'django.cpre.mail.backends.smtp.EmailBackend'
#EMAIL发送服务器
EMAIL_HOST = 'smtp.qq.com'
#EMAIL发送端口
EMAIL_PORT = '465'
#EMAIL授权码
EMAIL_HOST_PASSWORD = 'jsdqchtegwxjbhjd'
# qq邮箱此值为True,163可以忽略此值
EMAIL_USE_TLS = True
#邮EMAIL发送人
EMAIL_FROM = '344846258@qq.com'

 

def send_my_email(request):
    title = '标题'
    msg = '消息体'
    email_from = settings.EMAIL_FROM
    reciever = [
        '744537385@qq.com'
    ]
    send_mail(title,msg,email_from,reciever)
    return HttpResponse('发送成功')

 

posted @ 2019-05-17 15:43  澄心元素  阅读(184)  评论(0编辑  收藏  举报