I have a javaservlet SendMail.java which is used to send email via JavaMail API using Gmail SMTP server.I am using the NetBeans IDE for coding.
The email address of the recipient is retrieved from MySQL database using a query which is also part of the servlet. All of the code lies within the doPost() method.
These are the attributes set for the Properties object
And all I get is "Unknown SMTP host:smtp.gmail.com" on my browser.
I am able to ping "smtp.gmail.com".
Do I need to seperately download the jars of JavaMail API? My import statements(javax.mail.*) however do not show any error.
There was a suggestion to add a new session in GlassFish Admin page,however I am not sure if this is needed.
I know I am missing something,but haven't been able to figure it out even after a lot of googling.
Joined: Nov 05, 2012
Changing the port to 25 works for me now.Don't know why it didn't work the other way.