Gabriel Alvarez
Gabriel Alvarez

Reputation: 13

Sending emails on Django using SMTP and Gmail

I have the following problem with gmail and smtp, i allowed access to less secure apps on my gmail account and i'm able to send emails on my local computer, however when i try to send emails on the remote server that's hosting my application i keep getting SMTPAuthenticationError. I'm not sure what else do i need to do in order for this to work both locally and on the remote server. Anybody have any ideas?

I'm using Django 1.11.15 and Python 2.7.

These are the settings i have on my application:

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"

EMAIL_HOST = "smtp.gmail.com"

EMAIL_USE_TLS = True

EMAIL_PORT = 587

EMAIL_HOST_USER = "[email protected]"

EMAIL_HOST_PASSWORD = "mypassword"

Upvotes: 0

Views: 3167

Answers (1)

QIFENG LI
QIFENG LI

Reputation: 111

The password is your gmail's login password? Visit https://myaccount.google.com/security, On the left navigation panel, click Security. In Signing in to Google panel, click App passwords, to get a password. It work for me.

If it not work, check Django SMTPAuthenticationError.

Upvotes: 1

Related Questions