Django throws this error: SMTPException: STARTTLS extension is not supported by the server

Due to outgoing mail restrictions in gmail, I installed Exim4 on one of my servers with the following settings:

dc_eximconfig_configtype='internet'
dc_other_hostnames='mydomain.com, localhost, localhost.localdomain, mail.mydomain.com'
dc_local_interfaces=''
dc_readhost='mydomain.com'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='mydomain.com'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'

I also changed the firewall settings to allow an SMTP connection. Now I can send mail from this server using the following command:

    echo "TEST" | mail -s testing user@example.com

Now I want to use this server to send mail to my other remote server, reports mydomain2.com. I am using django on this second server. The current settings.py file settings are as follows:

EMAIL_HOST = 'mail.mydomain.com'
EMAIL_HOST_USER = 'username'  # username of one of my user on the first server
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 25
EMAIL_USE_TLS = True

When I try to send mail from this server using the above settings and the following code:

from django.core.mail import send_mail
send_mail('testing','test','from@example.com',['to@example.com'])

I get the following error:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py", line 61, in send_mail
    connection=connection).send()
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", line 248, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 85, in send_messages
    new_conn_created = self.open()
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 51, in open
    self.connection.starttls()
  File "/usr/lib/python2.7/smtplib.py", line 635, in starttls
    raise SMTPException("STARTTLS extension not supported by server.")
SMTPException: STARTTLS extension not supported by server.

, exim4.
, ts.
Advance.

+4
1

, Reto,
exim4 , "AUTHException:".
, , , . , settings.py :

EMAIL_HOST = 'localhost'
#EMAIL_HOST_USER = 'username'  # username of one of my user on the first server
#EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 25
#EMAIL_USE_TLS = True

!!!
Reto.

+2

All Articles