This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes JavaMail: Could not connect to SMTP host: localhost, port: 25; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JavaMail: Could not connect to SMTP host: localhost, port: 25;" Watch "JavaMail: Could not connect to SMTP host: localhost, port: 25;" New topic
Author

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

Sundarajan Srinivasan
Greenhorn

Joined: Apr 27, 2012
Posts: 8
This is my simple code to send a mail:



Sometime I face even 404 error. Please do help.
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

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

Joined: Mar 28, 2012
Posts: 859

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

Joined: Mar 06, 2011
Posts: 5

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


Bachelor of Computer Science | SCJP 5(97%) | SCWCD 5(100%) | SCBCD 5(100%) | http://codesstore.blogspot.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaMail: Could not connect to SMTP host: localhost, port: 25;