Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaMail: Could not connect to SMTP host: localhost, port: 25;

 
Sundarajan Srinivasan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my simple code to send a mail:



Sometime I face even 404 error. Please do help.
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What smtp server do you have set up on your localhost? Is it listening on port 25 or a different one? The netstat command might be useful.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Koen is correct.

If you do not have an email server/relay on localhost then of course it will fail.

You would normally only find those on a server, such as provided by an ISP or internal network group.

WP
 
Sameera Jayasekara
Greenhorn
Posts: 5
Firefox Browser Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my code for sending emails using Gmail SMTP settings.See it sometimes it may useful to you.
See http://codesstore.blogspot.com/2011/10/send-email-in-java-with-gmail.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic