After doing a bit of search on google, I found here a code snippet in the comments section that can be used to send emails through gmail. There was a minor typo in the code snippet in the "main" function, where class name was wrongly spelt as "MailUtils" instead of "SimpleMail".
This code depends on Java Mail API. I picked the "mail.jar" from Spring distribution's "lib" directory.
Thats it! I was sending emails from Java in no time.