码迷,mamicode.com
首页 > 其他好文 > 详细

django-发送文件

时间:2019-09-25 15:30:49      阅读:69      评论:0      收藏:0      [点我收藏+]

标签: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)

 

django-发送文件

标签:bsp   smt   class   pytho   cas   配置   http   客户   book   

原文地址:https://www.cnblogs.com/yifengs/p/11584711.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!