[Solved]-How can I send e-mail from django using the google smtp server?

11๐Ÿ‘

โœ…

You cannot use smpt.gmail.com without providing your auth_information i.e your gmail password.

However you can put your auth information in a local_settings.py and do not add this local_settings in version control so no one except you would see this file. Include this local_settings in your settings.py.

settings.py

 ...
 EMAIL_HOST = 'smtp.gmail.com'
 EMAIL_PORT = 587
 EMAIL_USE_TLS = True
 ...
 ...
 from local_settings import *

local_settings.py

EMAIL_HOST_USER = 'user@gmail.com'
EMAIL_HOST_PASSWORD = 'yourpassword'
๐Ÿ‘คAkshar Raaj

9๐Ÿ‘

try including this in settings.py:

# Email configuration.

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'user@domain.com'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'user@domain.com'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

If you have a web domain provider (like namecheap, godady, etc) you can associate you domain (mycompany.com) with Gmail. For that feature ask help in your domain provider or look info in Internet:

Hope it helps,
cheers.

๐Ÿ‘คCartucho

Leave a comment