You may need to enable "less secure" apps in your Gmail settings. See this answer and Google Accounts Help for more details.
I wouldn't be surprised if a future elementary OS release added Google OAuth login to online accounts, which would prevent users from having to do this. (That's of course 100% speculation, but I still hope it happens! 😀)