• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection refused  RSS feed

 
Ken Sampson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

This is the first time I am using JavaMail. I wrote a code in which the properties look like the following:

Properties prop = new Properties();
prop.put("mail.transport.protocol", "smtp");
prop.put("mail.smtp.host", "localhost");
prop.put("mail.smtp.port", "25");

when I run the code I get :

Connection refused, failure to connect to localhost at port 25.

Please let me know how to get around with this
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you connect to the port?
You can try by opening a console window, then entering "telnet localhost 25". If that also fails, you don't have an SMTP server on your machine.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!