title: How to send email with smtplib in Python with outlook account
body: <p>I was following this post to send an email using my outlook account:
  <a href="https://stackoverflow.com/questions/30314618/having-trouble-with-sending-an-email-through-smtp-python">Having trouble with sending an email through SMTP Python</a></p>
  
  <p>I used that and made a simple test code as follows</p>
  
  <pre><code>username='****'
  password='***'
  mailServer = smtplib.SMTP('smtp-mail.outlook.com', 587)
  mailServer.ehlo()
  mailServer.starttls()
  mailServer.ehlo()
  mailServer.login(username, password)
  </code></pre>
  
  <p>But it fails with this error</p>
  
  <pre><code>Traceback (most recent call last):
  
    File "&lt;ipython-input-3-67589181ed6a&gt;", line 7, in &lt;module&gt;
  mailServer.login(username, password)
  
    File "/home/saber/miniconda3/envs/explore/lib/python3.6/smtplib.py", line 730, in login
  raise last_exception
  
    File "/home/saber/miniconda3/envs/explore/lib/python3.6/smtplib.py", line 721, in login
  initial_response_ok=initial_response_ok)
  
    File "/home/saber/miniconda3/envs/explore/lib/python3.6/smtplib.py", line 642, in auth
  raise SMTPAuthenticationError(code, resp)
  
  SMTPAuthenticationError: (535, b'5.7.3 Authentication unsuccessful [YQXPR0101CA0037.CANPRD01.PROD.OUTLOOK.COM]')
  </code></pre>
  
  <p>Any idea what might be the problem?</p>