0

I've made a page that is supposed to send an email to the to_email when the submit button is clicked inside of a form. I disabled captchas using this link as I was advised in this video playlist that I've been following for tutorials but for some reason, I'm getting an authentication error. I found an answer to a similar problem here but it involved using the string version of the HOST_password in the settings.py file, which I am already doing. The emails and passwords that I am using are correct, so what could be causing the problem?

Below is the traceback log from the page:

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')
loremIpsum1771
  • 2,497
  • 5
  • 40
  • 87
  • 1
    I really hope that's not your real email and password that you've stored in the git repository. – Alasdair Nov 27 '15 at 22:24
  • Possible duplicate of [Django- \[Errno 111\] Connection refused when using smtp](http://stackoverflow.com/questions/33950585/django-errno-111-connection-refused-when-using-smtp) – gffbss Nov 27 '15 at 22:34

2 Answers2

4

You have misspelled one of your settings. You have:

EMAIL_HOSTS_USER = '<your email>'

It should be:

EMAIL_HOST_USER = '<your email>'
Alasdair
  • 298,606
  • 55
  • 578
  • 516
0

Also try app specific passwords if you have 2 step authentication turned on. https://support.google.com/accounts/answer/185833?hl=en

  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/34713901) – Chenmunka Jul 22 '23 at 15:09
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 23 '23 at 05:39