File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes how to solve Below error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "how to solve Below error?" Watch "how to solve Below error?" New topic

how to solve Below error?

vijay Panner
Ranch Hand

Joined: Sep 29, 2010
Posts: 30
i m developing an application using swing. i want to perform java mail operation in my application. i try to run simple program,
that arise this exception.Here i am using javamail.jar and activation.jar. how i solve this one. and how to use mailing operation in my application. please help

Exception in thread "main" javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(
at com.sun.mail.smtp.SMTPTransport.protocolConnect(
at javax.mail.Service.connect(
at javax.mail.Service.connect(
at javax.mail.Service.connect(
at javax.mail.Transport.send0(
at javax.mail.Transport.send(
at SendMail.main(
Caused by: Connection refused: connect
at Method)
at Source)
at Source)
at Source)
at Source)
at Source)
at Source)
at com.sun.mail.util.SocketFetcher.createSocket(
at com.sun.mail.util.SocketFetcher.getSocket(
at com.sun.mail.smtp.SMTPTransport.openServer(
... 7 more
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Do you have an SMTP server running on port 25 on localhost? You'll need some mail server to send mails.
I agree. Here's the link:
subject: how to solve Below error?
It's not a secret anymore!