1

I'm trying to send submitted form data to an email address but am getting this error.

Here's my views.py

def contactform(request):
    contact_form = ContactForm(data=request.POST)
    if contact_form.is_valid():
            data = contact_form.cleaned_data
            send_mail(subject=data['subject'], 
                      message=data['message'], 
                      from_email=data['email'],
                      recipient_list=['jzakaria2000@gmail.com'], 
                      fail_silently=False)
            return HttpResponseRedirect('/')

settings.py

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'zetapsiuchicago@gmail.com'
EMAIL_HOST_PASSWORD = os.getenv('WEBSITE_PASS')

I've tried googling for solutions to this error, but have so far been unsuccessful. If anyone could help me out with this issue or point me in the right direction, I'd really appreciate it

Jawwad Zakaria
  • 1,139
  • 3
  • 13
  • 27

1 Answers1

2

Adding password in plain text will remove your 5.5.1 Authentication Required Error.

suppose your password is 123weq add it as

EMAIL_HOST_PASSWORD = '123weq'

setting.py

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'zetapsiuchicago@gmail.com'
EMAIL_HOST_PASSWORD = 'password of zetapsiuchicago@gmail.com in plain text'
Imran Tufail
  • 480
  • 5
  • 12
  • as in add the password in plain text? – Jawwad Zakaria Oct 02 '14 at 17:21
  • 1
    how does that make a difference? I've set the password as an environment variable and just use os.getenv('WEBSITE_PASS') to fetch it – Jawwad Zakaria Oct 03 '14 at 13:51
  • may be you have wrong pass or format is not correct or may getenv is unable to access pass but the password in plain text will work for you. – Imran Tufail Oct 03 '14 at 14:11
  • This is not recommended right as a best-practice to have passwords as plain text in the code repository. So although this is what got it working..I am still wondering why the password read as an environment variable does not work..when that is the reocmmended way to read in passwords – harijay Oct 28 '16 at 23:02