Log into your Gmail account.
Click the gear icon at the top right
then choose Settings.
Click Forwarding and POP/IMAP to bring up the POP and IMAP settings.
Click Enable IMAP.
Click Save Changes.
Go to google account settings
Go to sign in and security, scroll to the bottom, turn allow less secure apps ON
...