Hi @Smita, you are facing this problem because Gmail allows highly secure transmissions and blocks any app which tries to access or send mails to gmail. So to resolve this error, try allowing the 'Allow Less Secure Apps' feature in security settings of your google account.
Go to this link https://myaccount.google.com/ and click on 'Security'. Then scroll down and navigate to 'Less Secure App Access'. Now click on 'Turn On Access'
Now run your bot and try sending or receiving email. I hope it will work.