为了账号安全,请及时绑定邮箱和手机立即绑定

Django Web 应用程序中的 SMTP 问题

Django Web 应用程序中的 SMTP 问题

狐的传说 2021-06-11 19:30:25
我被要求向使用 Django/Python 框架实现的现有程序添加一个功能。此功能将允许用户单击按钮,该按钮将显示一个小对话框/表单以输入值。我确实写了一些代码来显示电子邮件已发送的消息,但实际上,它没有发送!我的代码:from django.shortcuts import renderfrom django.core.mail import send_mail# Create your views here.def index(request):    send_mail('Request for a Clause',    'This is an automated email. Jeff, please submit the case for 1234567',    'akohan@mycompay.com',    ['jjohnson@mycompany.com'],    fail_silently=False)    return render(request, 'send/index.html')在项目根目录中,setting.py我添加了 SMTP 配置:EMAIL_HOST = 'mail.mycompany.com'EMIAL_PORT = 587#EMAIL_HOST_USER = 'akohan@mycompany.com'  ;no need it is on the white list#EMAIL_HOST_PASSWORD = '' ;no need it is on the white listEMAIL_USE_TLS = TrueEMAIL_USE_SSL = False我通过键入来运行它:python manage.py  SendEmailApp我在这里缺少什么?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 119 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号