Django Web 应用程序中的 SMTP 问题

我被要求向使用 Django/Python 框架实现的现有程序添加一个功能。此功能将允许用户单击按钮,该按钮将显示一个小对话框/表单以输入值。


我确实写了一些代码来显示电子邮件已发送的消息,但实际上,它没有发送!


我的代码:


from django.shortcuts import render

from 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 list


EMAIL_USE_TLS = True

EMAIL_USE_SSL = False

我通过键入来运行它:


python manage.py  SendEmailApp

我在这里缺少什么?


狐的传说
浏览 120回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python