There will be an authentication error if you input your gmail and password like usual:
raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials m6-20020a056000180600b00332e73f8231sm2207249wrh.39 - gsmtp')
 
To solve this issue, you need to
1. Go to your google account settings
  1. Security How you sign in to Google → 2-Step Verification
  1. Set APP Password, this 16 bits password can be used the by your python code without authentication issue.
wenyang@wenyang:~/email$ python3 email_sender.py please input your email address ************@gmail.com please input your password znqc********** all done!