title: Sending email with python. Google disables less secure apps
body: <p>I am trying to send email using python. My code was working fine before Google disabled 'less secure apps'. My email address and password are both correct.</p>
  <pre><code>server = smtplib.SMTP_SSL(&quot;smtp.gmail.com&quot;, 465)
  serverEmail = &quot;EMAILADDRESS&quot;
  serverPw = &quot;QWERTY&quot;
  server.login(serverEmail, serverPw)
  subject = &quot;Rejection&quot;
  body = &quot;Hi! You've been unfortunately declined access to our system.&quot;
  message = f'Subject: {subject}\n\n{body}'
  server.sendmail(&quot;EMAILADDRESS&quot;, doctorEmail['email'], message)
  server.quit()
  </code></pre>
  <p>I get this error now:</p>
  <blockquote>
  <p>smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted.</p>
  </blockquote>
  <p>I get this error when i use <code>server.starttls()</code>:</p>
  <blockquote>
  <p>smtplib.SMTPNotSupportedError: STARTTLS extension not supported by server.</p>
  </blockquote>