I had the same issue, but it was resolved by going to gmail's security settings and Allowing Less Secure apps. The Code from Domenic & Donny works, but only if you enabled that setting
If you are signed in (to Google) you can follow this link and toggle "Turn on" for "Access for less secure apps"