标签:bsp smt class pytho cas 配置 http 客户 book
客户端授权密码”,勾选“开启”,弹出新窗口填写手机验证码。
settings.py配置
EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend‘ EMAIL_HOST = ‘smtp.163.com‘ EMAIL_PORT = 25 #发送邮件的邮箱 EMAIL_HOST_USER = ‘itcast88@163.com‘ #在邮箱中设置的客户端授权密码 EMAIL_HOST_PASSWORD = ‘python808‘ #收件人看到的发件人 EMAIL_FROM = ‘天天生鲜<itcast88@163.com>‘ # 邮箱要与发件邮箱一致
在booktest/views.py文件中新建视图send
from django.conf import settings from django.core.mail import send_mail from django.http import HttpResponse ... def send(request): msg=‘<a href="http://www.itcast.cn/subject/pythonzly/index.shtml" target="_blank">点击激活</a>‘ send_mail(‘注册激活‘,‘‘,settings.EMAIL_FROM, [‘itcast88@163.com‘], html_message=msg) return HttpResponse(‘ok‘)
标签:bsp smt class pytho cas 配置 http 客户 book
原文地址:https://www.cnblogs.com/yifengs/p/11584711.html