Run this app by passing 2 arguments as: [email protected] secretPass123
For Gmail make sure you've enabled:
Less secure app access (go to https://myaccount.google.com/ by Security.) Enable IMAP (https://mail.google.com/mail/u/0/#settings/fwdandpop) For 2-factor-verification get third-party app access key