Had the same error with gmail and was able to fix it.
For me it was a problem with a setting in Gmail. It seems that iPhoto isn't using SSL even though it has the check box.
Solution for me:
- Go here https://www.google.com/settings/security/lesssecureapps
- Read the details carefully, what you're about to do is NOT recommended by google
- If you still want to get iPhoto to work click on 'Enable' which will decrease the security settings on your gmail account
Presto magic! It works.
Personally I think this is a bug, I'm not sure if apple was sending security and stopped or if google got more secure by default but it seems like something apple should be fixing in iPhoto. I was able to send and receive from Mail without any problems before changing the setting, they clearly have the code to do things properly... Apple please port that code to iPhoto!