I am trying to send an email with an attachment file in Java.
When I send the email without an attachment I receive the email, but when I add the attachment I don\'t
See the JavaMail FAQ for debugging tips. In particular, the protocol trace will tell you more about what's going on in each case. While you're there you'll find tips for using GMail as well.
If the only difference is really just the addition of an attachment, it seems unlikely that it's an authentication problem. You may be getting an exception that you're not noticing since your send method is declared to throw MessagingException.