I'm reposting my response to a similar question here.
Try this, assuming you're using iPhoto 11 and Mountain Lion:
- Within the iPhoto application, click on iPhoto in the menu bar
- Click on Preferences
- Within Preferences, click on Accounts
- Your Gmail account should be present. Click on Gmail under Accounts.
- Put in the proper information. Your full gmail address is your username (put this under Email address). Outgoing Mail Server is smtp.gmail.com Port is 465 Password is your password. Use Secure Sockets Layer (SSL) should be checked.
- Upon making these changes, click on the red "close" button in the top left corner of the pop-up window. Choose to Save Changes.
- Close iPhoto.
- Reopen iPhoto. You should now be able to share photos.
I hope this helps. One suggestion for you, by the way. It's always best to include the application version and the operating system version you're using when asking for help. The above solution will not apply, at least exactly, to anything other than iPhoto 11 and Mountain Lion.