Here are the steps to enable IMAP on your Gmail account
Step 1: Enable IMAP
In your Gmail account (link)
Step 2: Generate An App Password For Mail:
A - If 2 Step Verification is enabled
On the same page, you have to define a specific password to be entered in Salesmachine.
Create Google App Passwords (link)
Choose "Mail" under the "Select app" dropdown
Set an application name: Salesmachine
You will use this password to connect on Step 3.
B - If 2 Step Verification id OFF
Verify the Less secure app access is ON
Otherwise you will receive a warning email from Google