gpt4 book ai didi

python - Django - 从联系表单发送电子邮件时 SMTPSenderRefused

转载 作者:太空宇宙 更新时间:2023-11-03 17:12:24 24 4
gpt4 key购买 nike

我制作了一个页面,当单击表单内的提交按钮时,该页面应该向 to_email 发送电子邮件。我使用 this link 禁用了验证码正如我在 this video playlist 中所建议的那样我一直在关注教程,但由于某种原因,我收到身份验证错误。我找到了类似问题的答案here但它涉及在 settings.py 文件中使用 HOST_password 的字符串版本,我已经在这样做了。我使用的电子邮件和密码是正确的,那么是什么原因导致了这个问题呢?

以下是页面的回溯日志:

Django Version: 1.8.6
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'artist_tracker')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/students/test/bandsync/src/bandsync-repo/artist_tracker/views.py" in contact
58. send_mail(subject, contact_message, from_email, to_email, fail_silently =False)
File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py" in send_mail
62. return mail.send()
File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py" in send
303. return self.get_connection(fail_silently).send_messages([self])
File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py" in send_messages
107. sent = self._send(message)
File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py" in _send
123. self.connection.sendmail(from_email, recipients, message.as_bytes(linesep='\r\n'))
File "/usr/lib/python2.7/smtplib.py" in sendmail
731. raise SMTPSenderRefused(code, resp, from_addr)

Exception Type: SMTPSenderRefused at /contact/
Exception Value: (530, '5.5.1 Authentication Required. Learn more at\n5.5.1 https://support.google.com/mail/answer/14257 l85sm10088128qhl.3 - gsmtp', u'webmaster@localhost')

最佳答案

您的一项设置拼写错误。你有:

EMAIL_HOSTS_USER = '<your email>'

应该是:

EMAIL_HOST_USER = '<your email>'

关于python - Django - 从联系表单发送电子邮件时 SMTPSenderRefused,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33965445/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com