File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unknown SMTP host: smtp.gmail.com

 
Chaitra Kear
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 502
Eclipse IDE Firefox Browser Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic