title: Office365 smtp server does not respond to ehlo() in python
body: <p>I am trying to use Office365 smtp server for automatically sending out emails. My code works previously with gmail server, but not the Office365 server in Python using smtplib. </p>
  
  <p>My code:</p>
  
  <pre><code>import smtplib
  
  server_365 = smtplib.SMTP('smtp.office365.com', '587')
  
  server_365.ehlo()
  
  server_365.starttls()
  </code></pre>
  
  <p>The response for the ehlo() is: <code>(501, '5.5.4 Invalid domain name [DM5PR13CA0034.namprd13.prod.outlook.com]')</code></p>
  
  <p>In addition, .starttls() raises a <code>SMTPException: STARTTLS extension not supported by server</code></p>
  
  <p>Any idea why this happens? </p>