[Django]-Django โ€“ SMTPAuthenticationError

6๐Ÿ‘

โœ…

You need to add SMTP server settings to your settings.py file. Example:

EMAIL_HOST = 'smtp.example.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'mailer@example.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_USE_TLS = True

From Django documentation:

Mail is sent using the SMTP host and port specified in the EMAIL_HOST and EMAIL_PORT settings. The EMAIL_HOST_USER and EMAIL_HOST_PASSWORD settings, if set, are used to authenticate to the SMTP server, and the EMAIL_USE_TLS setting controls whether a secure connection is used.

3๐Ÿ‘

set allow lesssecureapps ON for your gmail account which you have used as EMAIL_HOST
from here
https://myaccount.google.com/lesssecureapps
along with this settings in settings.py

EMAIL_HOST = 'smtp.example.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'mailer@example.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_USE_TLS = True

Leave a comment