1

I have created a Django app and deployed on to Heroku. I have a view which sends invitation to a new person. Everything is working fine on the local machine. After I deployed it on to Heroku with

DEBUG=FASLE

in setttings.py

I'm getting an error Server Error (500)

here is what i have added in my settings.py file

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = 'youremail@gmail.com'
EMAIL_HOST_PASSWORD = 'yourpwd'
# lesssecureappas  - https://myaccount.google.com/u/2/lesssecureapps?utm_source=google-account&utm_medium=web
# cpatcha -- https://accounts.google.com/b/0/DisplayUnlockCaptcha
EMAIL_SUBJECT_PREFIX = 'test'
SERVER_EMAIL = EMAIL_HOST_USER

I have even allowed access to captcha and less secure apps.

It is working fine for 24 hours on production when I grant access. The very next day it is rasing the same error. How to approach this issue. I have hardcoded the values instead of variables. Please suggest any ideas?

Bumblebee
  • 179
  • 1
  • 16
  • Simply turn the debug to true and see what's wrong. – Hisham___Pak May 14 '20 at 20:43
  • What do you have in the Heroku logs? – Wariored May 14 '20 at 20:48
  • SMTPAuthenticationError at /add_members/2 (534, b'5.7.14 \n5.7.14 Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 u7sm45608qkc.1 - gsmtp') this is the error that i'm getting on the logs – Bumblebee May 14 '20 at 20:50
  • Your google account is locked, it may force you to change password. This is not programming question. You can check out same question that was also closed as this should be https://stackoverflow.com/questions/20337040/getting-error-while-sending-email-through-gmail-smtp-please-log-in-via-your-w – iklinac May 14 '20 at 21:42
  • I have created a two-step verification for the app on Gmail. Now it is working. I will test this tomorrow and post if I find any issues. Thank you @iklinac – Bumblebee May 15 '20 at 01:08

0 Answers0