Hello everyone, I have an application that in the registry sends emails. The problem is that the electric mail is sent when I run the django application on my PC but it does not work when it is run on the VPS server.
Why can this be? Why does it work on my PC and not on the VPS?
in the end of setting.py is this:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'email@example.com' EMAIL_HOST_PASSWORD = 'xxxx xxxx xxxx xxxx' #past the key or password app here EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_USE_SSL = False DEFAULT_FROM_EMAIL = 'default from email'
And this is the function which sends the email:
def send_user_mail(randomNumber, email,subject,msg):
#message.attach_alternative(content, 'text/html') send_mail(subject, msg,'firstname.lastname@example.org', [email],fail_silently = False) #Destinatario)