我已经建立了一个cookiecutter-django
测试项目,它可以很好地将确认电子邮件打印到控制台。但是,对我来说,测试电子邮件的实际发送也很重要,当我尝试调整本地测试环境的设置时,SMTP AUTH extension not supported by server.
在添加新帐户后它给了我一个错误。
我在设置文件中EMAIL_BACKEND
更改EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
并添加了相关EMAIL_HOST
的 , EMAIL_PORT
,EMAIL_HOST_USER
和设置。EMAIL_HOST_PASSWORD
local.py
我正在使用为此目的设置的雅虎帐户,并且在 Django 之外工作得很好。
我在文档中找不到cookie-cutter
有关如何配置它的任何内容,而 Django 文档也没有什么帮助。
编辑添加:
电子邮件设置:
EMAIL_PORT = 587
EMAIL_HOST = 'smtp.mail.yahoo.com'
EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.smtp.EmailBackend')
完整追溯:
Internal Server Error: /accounts/signup/
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 53, in inner
return func(*args, **kwds)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 210, in dispatch
return super(SignupView, self).dispatch(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 79, in dispatch
**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 188, in dispatch
**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 102, in post
response = self.form_valid(form)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/views.py", line 231, in form_valid
self.get_success_url())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/utils.py", line 188, in complete_signup
signal_kwargs=signal_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/utils.py", line 151, in perform_login
send_email_confirmation(request, user, signup=signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/utils.py", line 319, in send_email_confirmation
signup=signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/models.py", line 60, in send_confirmation
confirmation.send(request, signup=signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/models.py", line 166, in send
get_adapter(request).send_confirmation_mail(request, self, signup)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/adapter.py", line 447, in send_confirmation_mail
ctx)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/allauth/account/adapter.py", line 140, in send_mail
msg.send()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/mail/message.py", line 348, in send
return self.get_connection(fail_silently).send_messages([self])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 104, in send_messages
new_conn_created = self.open()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/mail/backends/smtp.py", line 71, in open
self.connection.login(force_str(self.username), force_str(self.password))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/smtplib.py", line 696, in login
"SMTP AUTH extension not supported by server.")
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.