Django send email through Gmail


/ Published in: Django
Save to your folder(s)



Copy this code and paste it in your HTML
  1. In settings.py
  2.  
  3. EMAIL_USE_TLS = True
  4. EMAIL_HOST = 'smtp.gmail.com'
  5. EMAIL_HOST_USER = '[email protected]'
  6. EMAIL_HOST_PASSWORD = 'yourpassword'
  7. EMAIL_PORT = 587
  8.  
  9. You can use the shell to test it:
  10.  
  11. >>> from django.core.mail import send_mail
  12. >>> send_mail('Test', 'This is a test', '[email protected]', ['[email protected]'])

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.