Send email using Gmail, Django, and Mezzanine
I’m trying to send notification emails using Django (1.6.1) and Mezzanine on Ubuntu 14.04. This is in my settings.py:
EMAIL_HOST = 'smtp.gmail.com' EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = 'firstname.lastname@example.org' EMAIL_HOST_PASSWORD = 'secret'
This returns: [Errno 111] Connection refused
But I can send email from the console like this:
>> from django.core.mail import send_mail >> send_mail('Subject here', 'Here is the message.', 'email@example.com', ['firstname.lastname@example.org'], fail_silently=False)
It return 1 and I actually got the email. I’ve tried Mandrill as well and got the same results.
After reading various threads, do I need to install Postfix to act as a relay or can I directly access the SMTP servers and email? I’d like to avoid installing Postfix if possible.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.