Posted By

martin_rusev on 01/17/10


Tagged

email django


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

NARKOZ
Calvista
leachypeachy
mavix
caruso_g


Django send email through Gmail


 / Published in: Django
 

  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
Posted By: jameo on November 18, 2010

I setup django settings.py file for sending e-mails, as described in "Django send email through Gmail" example. But when I ran the django shell, the only way to send the email successfully was to add authuser and authpassword as parameters in send_mail call. It's no big deal for me to add them, but I was still mystified that I could not duplication your example.

Posted By: jameo on November 19, 2010

I apologize for my Nov. 18th posting. Code in this snippet works just fine. My mistake.

Posted By: liange on June 21, 2011

Can this email handling be used in the website contact form ? Please assist regarding it. seo reseller packages

You need to login to post a comment.