Sending email in Django is easy, just add a few lines in your settings.py and you have everything ready to send an email. But if you’re using Gmail as your SMTP server you need add a few more lines to your settings.py. You need to specify what port Gmail server using and set to use TLS.
EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = 'your-username@gmail.com' EMAIL_HOST_PASSWORD = 'your-password' EMAIL_PORT = 587 EMAIL_USE_TLS = True
You can go to the shell to test it:
$python manage.py shell>>> from django.core.mail import send_mail >>> send_mail('test email', 'hello world', to=['test@komunitasweb.com'])
That’s it, now you can have Gmail SMTP server in Django.
Related posts:
- Receiving Email Using AppEngine and Django
- Django Tutorial – Simple Notes Application
- Set Different Settings for Development in Django
- Email Validation Challenge
- Relative Path for your Django Project
Tags: django
June 23rd, 2010 | Comments(3)

[...] This post was mentioned on Twitter by KomunitasWeb, Django Ireland. Django Ireland said: Sending Email Using Gmail Account in Django | KomunitasWeb http://bit.ly/a87dYT [...]
Pingback by Tweets that mention Sending Email Using Gmail Account in Django | KomunitasWeb -- Topsy.com — June 23, 2010 @ 7:51 am
New blog posting, Sending Email Using Gmail Account in Django – http://tinyurl.com/39vse5q
This comment was originally posted on Twitter
Comment by komunitasweb — June 23, 2010 @ 6:46 am
Sending Email Using Gmail Account in Django | KomunitasWeb http://bit.ly/a87dYT
This comment was originally posted on Twitter
Comment by DjangoIreland — June 23, 2010 @ 7:39 am