title: smtplib.SMTPServerDisconnected: Connection unexpectedly closed
body: <p>i am trying to execute the following code on terminal with django.core.mail send_mail</p>
  <pre><code>send_mail('some title','some text','myemail@gmail.com',['otheremail@gmail.com'])
  </code></pre>
  <p>but after execution the console is showing this error</p>
  <pre><code>Traceback (most recent call last):
    File &quot;&lt;console&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/home/adjtlikp/virtualenv/globalit-web/3.7/lib/python3.7/site-packages/django/core/mail/__init__.py&quot;, line 61, in send_mail
      return mail.send()
    File &quot;/home/adjtlikp/virtualenv/globalit-web/3.7/lib/python3.7/site-packages/django/core/mail/message.py&quot;, line 284, in send
      return self.get_connection(fail_silently).send_messages([self])
    File &quot;/home/adjtlikp/virtualenv/globalit-web/3.7/lib/python3.7/site-packages/django/core/mail/backends/smtp.py&quot;, line 102, in send_messages
      new_conn_created = self.open()
    File &quot;/home/adjtlikp/virtualenv/globalit-web/3.7/lib/python3.7/site-packages/django/core/mail/backends/smtp.py&quot;, line 62, in open
      self.connection = self.connection_class(self.host, self.port, **connection_params)
    File &quot;/opt/alt/python37/lib64/python3.7/smtplib.py&quot;, line 251, in __init__
      (code, msg) = self.connect(host, port)
    File &quot;/opt/alt/python37/lib64/python3.7/smtplib.py&quot;, line 338, in connect
      (code, msg) = self.getreply()
    File &quot;/opt/alt/python37/lib64/python3.7/smtplib.py&quot;, line 394, in getreply
      raise SMTPServerDisconnected(&quot;Connection unexpectedly closed&quot;)
  smtplib.SMTPServerDisconnected: Connection unexpectedly closed
  </code></pre>
  <p>my settings.py</p>
  <pre><code>EMAIL_USE_TLS = True  
  EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'   
  EMAIL_HOST = 'smtp.gmail.com'  
  EMAIL_HOST_PASSWORD = 'mypass'  
  EMAIL_HOST_USER = 'myemail@gmail.com'   
  EMAIL_PORT = 465 
  DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
  </code></pre>
  <p>i tryed to change the EMAIL_PORT and the EMAIL_HOST but nothing changed the intersting is that in localhost the code work perfect but when i am using the host the errors came to me</p>