title: How can I solve smtplib.SMTPAuthenticationError?
body: <p>I am trying to sign in into my <code>Gmail</code> to send emails from <code>Python</code>, exactly from <code>SMTPlib</code> library.</p>
  <p>I checked some answers here and most of them mention that I should allow <code>Less secure apps</code>, I did that already, I also have <code>2-Step Authentication</code> turned off.</p>
  <p>Here is exactly what I tried :</p>
  <pre><code>import smtplib, ssl
  from email.message import EmailMessage
  
  my_email = &quot;xxxxx@gmail.com&quot;
  my_password = &quot;Mypasswrd&quot;
  other_email = &quot;xxxxx@gmail.com&quot;
  
  email = EmailMessage()
  email['from'] = my_email
  email['to'] = other_email
  email['subject'] = 'Test'
  email.set_content('Just testing')
  smtp = smtplib.SMTP(host='smtp.gmail.com',port=587)
  smtp.ehlo()
  smtp.starttls()
  smtp.login(my_email,my_password)
  </code></pre>
  <p>And here is the error message I keep getting:</p>
  <pre><code>smtplib.SMTPAuthenticationError: (534, b'5.7.14 &lt;https://accounts.google.com/signin/continue?sarp=1&amp;scc=1&amp;plt=AKgnsbv\n5.7.14 MKRQdTnq4XnXPAPVi9BKgDrbJ-EarzJPoivk3G1WLburL60D14QnkyWEy78Xj_kvdgcuQ\n5.7.14 ATCC_NvPh1JEpdKSCWlfKMdiP6ZvqsoqCVeQXpRQMqpq_Js25fKsdnZG_0A8sLLL&gt;\n5.7.14 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/answer/78754 21sm9494384wme.6 - gsmtp')
  </code></pre>
  <p>Any help please?</p>
  <p>Thanks.</p>