Simple Mail Transfer Protocol (SMTP) is a protocol, which handles sending e-mail and routing e-mail between mail servers. The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon.
The email module is a library for managing email messages. It is specifically not designed to do any sending of email messages to SMTP, NNTP, or other servers; those are functions of modules such as smtplib and nntplib. The email package attempts to be as RFC-compliant as possible.
Enable Less secure app access to send mail from Gmail Account. To enable follow the below steps
Login to accounts.goole.com -> Click on Security -> Scroll down and Turn On the option called 'Less secure app access'
Please make sure to update tests as appropriate.