aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Unable to connect using JavaMail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Unable to connect using JavaMail" Watch "Unable to connect using JavaMail" New topic

Unable to connect using JavaMail

S Mithal

Joined: Mar 17, 2005
Posts: 19

I am writing a JAVAMail client to send an email to from . Both are legal mail addresses.

This is how I set the server name
props.put("", "");

My code compiles butI get an error while executing:

javax.mail.SendFailedException: Sending failed;
nested exception is: javax.mail.MessagingException: Could not connect to SMTP host:, port: 25;
nested exception is: Connection timed out: connect
at javax.mail.Transport.send0(
at javax.mail.Transport.send(
at Mail.postMail(
at Mail.main(

I have enabled the port 25 explicitly.

S Mithal
I agree. Here's the link:
subject: Unable to connect using JavaMail
Similar Threads
excveption in mail api please help
JavaMail connection refused
smtp host in java mail program
Automail not working
Need some help me java mail-smtp