GeeCON Prague 2014*
The moose likes Other JSE/JEE APIs and the fly likes Unknown SMTP host: smtp.gmail.com Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Unknown SMTP host: smtp.gmail.com" Watch "Unknown SMTP host: smtp.gmail.com" New topic
Author

Unknown SMTP host: smtp.gmail.com

Chaitra Kear
Greenhorn

Joined: Nov 05, 2012
Posts: 7
I have a java servlet 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.
Chaitra Kear
Greenhorn

Joined: Nov 05, 2012
Posts: 7
Changing the port to 25 works for me now.Don't know why it didn't work the other way.
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Chaitra Kear wrote:Changing the port to 25 works for me now.Don't know why it didn't work the other way.

Hmm, strange. GMail SMTP is listening on port 587 by default.


PM Me If You Want to get Urgent Help on Java Programming
 
GeeCON Prague 2014
 
subject: Unknown SMTP host: smtp.gmail.com