Email failed to send Error: (534, b'5.7.9 Application-specific password required. For more information, go to\n5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor 2adb3069b0e04-53dbd47b535sm379249e87.256 - gsmtp')
try:
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
server.login(username, password)
server.sendmail(mail_from, mail_to, message_text)
print("Success: Email sent!")
except Exception as e:
print(f"Email failed to send Error: {e} ")