jQuery in Action, 2nd edition*
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
Author

how to solve Below error?

vijay Panner
Ranch Hand

Joined: Sep 29, 2010
Posts: 30
Hi
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:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at SendMail.main(SendMail.java:41)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:288)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)
... 7 more
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
Do you have an SMTP server running on port 25 on localhost? You'll need some mail server to send mails.


Ping & DNS - my free Android networking tools app
 
wood burning stoves
 
subject: how to solve Below error?
 
Similar Threads
Unknown SMTP host for gmail
send email using gmail account
Unable to send mail through mail api
Could not open connection to the host, on port 25: Connect Failed.
ClassNot found error