title: SMTPAuthenticationError when sending mail using gmail and python
body: <p>when i try to send mail using gmail and python error occurred this type of question are already in this site but doesn't help to me </p>
  
  <pre><code>gmail_user = "me@gmail.com"
  gmail_pwd = "password"
  TO = 'friend@gmail.com'
  SUBJECT = "Testing sending using gmail"
  TEXT = "Testing sending mail using gmail servers"
  server = smtplib.SMTP('smtp.gmail.com', 587)
  server.ehlo()
  server.starttls()
  server.login(gmail_user, gmail_pwd)
  BODY = '\r\n'.join(['To: %s' % TO,
          'From: %s' % gmail_user,
          'Subject: %s' % SUBJECT,
          '', TEXT])
  
  server.sendmail(gmail_user, [TO], BODY)
  print ('email sent')
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>    server.login(gmail_user, gmail_pwd)
      File "/usr/lib/python3.4/smtplib.py", line 639, in login
     raise SMTPAuthenticationError(code, resp)
     smtplib.SMTPAuthenticationError: (534, b'5.7.14   
     &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbtl1\n5.7.14       Li2yir27TqbRfvc02CzPqZoCqope_OQbulDzFqL-msIfsxObCTQ7TpWnbxIoAaQoPuL9ge\n5.7.14 BUgbiOqhTEPqJfb02d_L6rrdduHSxv26s_Ztg_JYYavkrqgs85IT1xZYwtbWIRE8OIvQKf\n5.7.14 xxtT7ENlZTS0Xyqnc1u4_MOrBVW8pgyNyeEgKKnKNyxce76JrsdnE1JgSQzr3pr47bL-kC\n5.7.14 XifnWXg&gt; Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 fl15sm17237099pdb.92 - gsmtp')    
  </code></pre>