You'll want to fix these common mistakes, and this mistake. You might just want to copy this code for connecting to Gmail. If that still doesn't work for you, follow these debugging steps to get more information so we can help you.
Note also that you can use the latest JavaMail jar file instead of the older mail.jar file linked to above.