我在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>'
有什么想法吗?
答案 0 :(得分:1)
Maillog强调:
致命:没有SASL身份验证机制
已解决:
yum install cyrus-sasl-plain