Django 1.8 sending mail using gmail SMTP

for me in settings.py:

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'test'
EMAIL_PORT = 587

and views.py:

from django.core.mail import EmailMessage

email = EmailMessage('title', 'body', to=[email])
email.send()
    

and: https://accounts.google.com/DisplayUnlockCaptcha

and also make sure you turn on permission for less secure apps.

Leave a Comment