我一直在尝试让django-registration-redux账户激活邮件发送给新注册的用户。
我已经让所有与邮件无关的部分正常工作,比如登录/注销和实际注册用户!当我注册时,它会自动将我登录为该用户。但我从未收到激活邮件。
我尝试了各种不同的方法来尝试让它工作,我遵循了一些设置整个过程的教程,但邮件仍然无法工作。
这是一些代码设置,我正在使用我在线下载的注册模板。
settings.py
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'registration',
'synths',
)
# user reg settings
REGISTRATION_OPEN = True
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = True
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/login/'
# i tried including this line but still nothing
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# email
# first i tried setting up the debbuging server with this CMD line
# python -m smtpd -n -c DebuggingServer localhost:1025
# i dont know if it worked!, i got no errors but the cursor just
# sat there blinking at me! i was expecting some output to tell me
# the server had started
# these were the settings i used for that
EMAIL_HOST = '127.0.0.1'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
# then i tried using my own address and smtp.live.com
EMAIL_HOST = 'smtp.live.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'myemailaddress@hotmail.com'
EMAIL_HOST_PASSWORD = '123123abcabc'
# still nothing
我需要确认一下,这里是否缺少重要的设置?
urls.py文件
# included amongst my other urls
(r'^accounts/', include('registration.backends.simple.urls')),
看起来教程和文档都很完整。像我说的,注册功能除了邮件之外都完美运行。
我注意到的一件事是,如果您希望用户激活他们的账户,那么您可能不应该将自动登录设置为True,但是注释掉那一行并没有改变任何内容,我仍然在注册后自动登录。这似乎是一个小问题,但也许与邮件无法正常工作有关?
我不知道,我对此感到困惑。要么我漏了一些设置,要么代码不起作用,要么Python smtpd不起作用,要么我的smtp.live.com设置有误!
非常感谢任何见解!
编辑:尝试“重置密码”电子邮件功能时,我收到了以下错误信息
SMTPException at /accounts/password/reset/
SMTP AUTH extension not supported by server.
Request Method: POST
Request URL: http://localhost:8000/accounts/password/reset/
Django Version: 1.7.6
Exception Type: SMTPException
Exception Value: SMTP AUTH extension not supported by server.
Exception Location: C:\Python34\lib\smtplib.py in login, line 613
Python Executable: C:\Python34\python.exe
Python Version: 3.4.3
编辑2:使用这些设置,我能够获得密码/重置/完成页面,但是没有收到实际的电子邮件。
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = '127.0.0.1'
EMAIL_PORT = 1025