Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm looking at https://docs.djangoproject.com/en/dev/topics/email/

My question is, is there way I can use smtp.google.com without authentication or without having to put my auth information into settings.py or as a parameter in the django.core.mail.send_mail function?

At this point I'm looking for best practices for using smtp.google.com on django, I understand there are better solutions such as http://sendgrid.com/

like image 540
statguy Avatar asked Apr 13 '13 07:04

statguy


1 Answers

try including this in settings.py:

# Email configuration.

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'yourpassword'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = '[email protected]'
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:

  • http://www.namecheap.com/support/knowledgebase/article.aspx/1244/78/
  • http://help.squarespace.com/customer/portal/articles/581494-how-do-i-set-up-google-apps-for-my-domain-

Hope it helps, cheers.

like image 56
Cartucho Avatar answered Oct 18 '22 08:10

Cartucho