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 = 'info@example.com'
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.', 'from@example.com',
['to@example.com'], 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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Same issue here:
from django.core.mail import send_mail send_mail(“oi”,“msg”,“atendimento@consultoriasigma.com.br”,[“george@consultoriasigma.com.br”],fail_silently=False) Traceback (most recent call last): File “<console>”, line 1, in <module> File “/opt/apps/.virtualenvs/sentry/local/lib/python2.7/site-packages/django/core/mail/init.py”, line 50, in send_mail connection=connection).send() File “/opt/apps/.virtualenvs/sentry/local/lib/python2.7/site-packages/django/core/mail/message.py”, line 276, in send return self.get_connection(fail_silently).send_messages([self]) File “/opt/apps/.virtualenvs/sentry/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py”, line 87, in send_messages new_conn_created = self.open() File “/opt/apps/.virtualenvs/sentry/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py”, line 48, in open local_hostname=DNS_NAME.get_fqdn()) File “/usr/lib/python2.7/smtplib.py”, line 256, in init (code, msg) = self.connect(host, port) File “/usr/lib/python2.7/smtplib.py”, line 316, in connect self.sock = self._get_socket(host, port, self.timeout) File “/usr/lib/python2.7/smtplib.py”, line 291, in _get_socket return socket.create_connection((host, port), timeout) File “/usr/lib/python2.7/socket.py”, line 571, in create_connection raise err error: [Errno 101] Network is unreachable
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.