Take a look at this https://support.google.com/accounts/answer/6010255?hl=en it deals with "Less secure apps" connecting to gmail.