I tried using the code that @Vinayak B submitted. However I'm getting an error saying: No provider for smtp
I created a new question for this with more information HERE
I was able to fix it myself after all. I had to use an other mail.jarand I had to make sure my "access for less secure apps" was turned on.
I hope this helps anyone who has the same problem. With this done, this piece of code works on the google glass too.