I have an app that sends out an email when an object is create, this is the code for sending email:
from django.core.mail import send_mail
send_mail("New entryis added", "Hi a new entry is added", "myemail@gmail.com", [c.email for c in CustomUser.objects.all()], fail_silently=False)
and this is my setting:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'myemail'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
I also made sure that my "Less secure app access" is on in google security setting. So with all thses I am able to send email with no issue in local server. However when I push the code to digital ocean droplet linux server, it throws some errors:
SMTPAuthenticationError at /a/b/c/add/
(534, b'5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu\n5.7.14 VVGrAjSoYzu_W9fGpWsq5B3qMs04qWLzeqnxkFdrMaeVJumRRljQzXEyYpA9xt1MSYaii\n5.7.14 iyVCj2qaXbQzY5Tvc3mux9qViJSKE5yOozpCzao_qU0FhjYGX8IZ1xgd9PUep41I>\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 g9sm2079574pgj.89 - gsmtp')
Exception Type: SMTPAuthenticationError
I apreciate if someone can shed some light on what is the issue, Thanks,