title: Problem sending email with Google App Password in my function
body: <p>I'm trying to create a function in Python that enables me to send an email from my email address to that of my intended recipient.</p>
  
  <p>I have set up Google's 2-Step Verification with my Gmail and have set up a Google App Password.</p>
  
  <p>So far, I have looked at examples online, but I don't know why <code>send_email()</code> is not working:</p>
  
  <pre><code>def send_email():
      server = smtplib.SMTP('smtp.gmail.com', 587)
      server.ehlo() 
      server.login('&lt;my_email_address&gt;', '&lt;google_app_password&gt;')
  
      subject = 'You've Got Mail!'
      body = 'How are you buddy?'
  
      message = f'Subject: {subject}\n\n{body}'
  
      server.sendmail(
          '&lt;my_email_address&gt;',
          '&lt;my_intended_recidpients_email_address&gt;',
          message
      )
      print('Email has been successfully sent')
  
      server.quit()
  </code></pre>
  
  <p>What could be the issue?</p>