Hi,
I am trying to send a mail using
java mail. Below is the code:
Running the code gives the following exception:
javax.mail.MessagingException: Could not connect to SMTP host: A1DAL1SWPES20MB.ams.acs-inc.net, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1545)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
at javax.mail.Service.connect(Service.java:313)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at javax.mail.Transport.send0(Transport.java:190)
at javax.mail.Transport.send(Transport.java:120)
at com.mail.utility.MailUtility.postMail(MailUtility.java:137)
at com.mail.utility.MailUtility.main(MailUtility.java:172)
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:267)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:227)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1511)
... 8 more
----------------------------------------------------------------------------
using the below sites i cam eto know that port 25 is blocked on my machine:
http://www.dbapool.com/portchecker.php
http://www.canyouseeme.org/
-----------------------------------------------
doing telnet to the server :
Microsoft Telnet> open A1DAL1SWPES20MB.ams.acs-inc.net 25
Connecting To A1DAL1SWPES20MB.ams.acs-inc.net...Could not open connection to the host, on port 25: Connect failed
--------------------------------------------------
Question:
1. How come Microsoft Outlook is able to access the same server and send and receive mails on my system?
2. Am i right in my understanding that the above exception is because port 25 is blocked?
Regards,
Vartika.