Django send mail not work in the server - django.core.mail

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 is this:

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST_PASSWORD = 'xxxx xxxx xxxx xxxx' #past the key or password app here
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,'', [email],fail_silently = False) #Destinatario)

You’ll probably need to run it (for a very short period of time, just long enough to test) with DEBUG = True and to check the logs to see what error message you’re receiving. There are only about a hundred different ways this can fail, and it’s generally futile to guess among them without more detailed information.

1 Like