我已经在 Centos 7 上安装了 Postfix,并成功将其配置为发送邮件(用命令行程序 MailX 测试)。
但是,当尝试通过 Django shell 或我的 Django 网站发送邮件时,我得到:
File "/usr/lib64/python2.7/smtplib.py", line 367, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed
我在 settings.py 中的邮件配置:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
DEFAULT_FROM_EMAIL = 'Admin <admin@mywebsite.com>'
有任何想法吗?