SMTPAuthenticationError at /members/register after deployment in heroku ut works in local host
I am getting the below error when I am trying to send an email to a user. It is working fine in localhost, but after deploying it to Heroku I am getting this error. My less secure app is turned on.
SMTPAuthenticationError at /members/register
(534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt\n5.7.14 iREvsLOCGsSdIvQozvsLAI32usRkAKeN9zrVcpG8_5BPTE8Cid59meSrouoFeVL7uexVM\n5.7.14 9BeaQ5gSKAKohzILe4Nqyrn_p3OJhBZJVuJ3Nb36rtmD2h_Rb7TCpJRB6xMw87Ow>\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 n7sm3256692wro.68 - gsmtp')
settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'myemail@gmail.com'
EMAIL_HOST_PASSWORD = 'password'
SERVER_EMAIL = EMAIL_HOST_USER