title: smtplib.SMTP Unable to Log in
body: <p>I would like to send an email from a python script. However, when I try run <code>server.login</code> I receive the following error: <code>smtplib.SMTPAuthenticationError: (535, '5.7.0 (#MBR1212) Incorrect username or password.')</code> </p>
  
  <p>I have tried this both with Gmail and Yahoo accounts. The Gmail error is:</p>
  
  <pre><code>smtplib.SMTPAuthenticationError: (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 u2sm21203448pbs.42 \
  - gsmtp')
  </code></pre>
  
  <p>The Yahoo error is</p>
  
  <pre><code>smtplib.SMTPAuthenticationError: (535, '5.7.0 (#MBR1212) Incorrect username or password.')
  </code></pre>
  
  <p>The code I am using is the following. Username and password are string variables that represent my correct username and password. </p>
  
  <pre><code>server = smtplib.SMTP('smtp.mail.yahoo.com', 587)
  server.ehlo()
  server.starttls()
  server.login(username, password)
  </code></pre>
  
  <p>I am using <code>Python 2.7.6 |Anaconda 1.8.0 (x86_64)| (default, May 27 2014, 14:58:54)</code></p>