title: SMTPlib unresponsive in Python
body: <p>I'm trying to automate sending some emails through Python. However, I'm having some trouble trying to connect to my email server.</p>
  <p>Here's the code I have:</p>
  <pre><code>import smtplib
  smptObj = smtplib.SMTP(&quot;webmail.incometax.gov.in&quot;,465)
  print(smptObj.ehlo)
  </code></pre>
  <p>However, when I try this, I get literally no response. My terminal (or Atom Script Package) just gives no result and hangs until I <code>control+Z</code> to override.</p>
  <p>I don't understand why this particular server is throwing up an error, particularly when <code>smtpObj=smtplib.SMTP(&quot;webmail.incometax.gov.in&quot;,465)</code> works.</p>
  <p>I'm getting the details for this particular server from <a href="https://webmail.incometax.gov.in/iwc_static/layout/docs/webmail-config.html?3.0.0.0.1_020745" rel="nofollow noreferrer">https://webmail.incometax.gov.in/iwc_static/layout/docs/webmail-config.html?3.0.0.0.1_020745</a> These details definitely work for setting up the account on the Gmail app, so I figured that the SMTPlib can also handle sending emails from this server.</p>
  <p>Edit/Update: I got the following error message. Can someone help explain to me what is going wrong? Especially since smtp.gmail.com works so well</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/Users/jvalin/Desktop/hello.py&quot;, line 13, in &lt;module&gt;
      smtpObj = smtplib.SMTP('webmail.incometax.gov.in', 465)
    File &quot;/opt/anaconda3/lib/python3.7/smtplib.py&quot;, line 251, in __init__
      (code, msg) = self.connect(host, port)
    File &quot;/opt/anaconda3/lib/python3.7/smtplib.py&quot;, line 338, in connect
      (code, msg) = self.getreply()
    File &quot;/opt/anaconda3/lib/python3.7/smtplib.py&quot;, line 394, in getreply
      raise SMTPServerDisconnected(&quot;Connection unexpectedly closed&quot;)
  smtplib.SMTPServerDisconnected: Connection unexpectedly closed
  [Finished in 597.573s]
  </code></pre>