我为我的项目使用django-registration来管理用户注册、登录等。但是当我注册一个帐户时,我遇到了这个问题:
SMTPServerDisconnected
作为记录,我确实在我的 settings.py 中配置了与电子邮件相关的设置:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 465
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'myemail@gmail.com'
EMAIL_HOST_PASSWORD = 'mypassword'
我还有所有需要和可访问的模板。所以这个问题与那个没有任何关系。
更多错误描述:
单击发送激活电子邮件后,它需要很长时间才能最终给出该错误。
这是回溯(不完整):
SMTPServerDisconnected at /accounts/register/
Connection unexpectedly closed
last trace back:
/usr/lib/python2.7/smtplib.py in getreply
line = self.file.readline()
except socket.error as e:
self.close()
raise SMTPServerDisconnected("Connection unexpectedly closed: "
+ str(e))
if line == '':
self.close()
raise SMTPServerDisconnected("Connection unexpectedly closed")
...
if self.debuglevel > 0:
print>>stderr, 'reply:', repr(line)
resp.append(line[4:].strip())
code = line[:3]
# Check that the error code is syntactically correct.
# Don't attempt to read a continuation line if it is broken.
感谢您的任何建议。