• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Unable to send mail through an application

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're most likely behind a firewall that doesn't let any traffic through to your machine, on port 25 or any other. That's why those web sites can't connect to it, and that's exactly as it should be.

But more importantly, port 25 on your machine is irrelevant, it's port 25 on the mail server that's being used.

Are you certain that the server name and port are correct?
 
vartika vaish
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Are you certain that the server name and port are correct?



Yes. I think McAfee on my machine has blocked port 25 but again what i do not understand is how is outlook connecting to the same server?
reply
    Bookmark Topic Watch Topic
  • New Topic