Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Send email via MS Exchange Server

843830Oct 16 2001 — edited Aug 11 2009
Hi everybody!

I have:
javax.mail.MessagingException: Could not connect to SMTP host: 13.2.45.22, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: no further information
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:867)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:156)
at javax.mail.Service.connect(Service.java:234)
at javax.mail.Service.connect(Service.java:135)
at test1.SendMail.sendmail(SendMail.java:177)
at test1.SendMail.main(SendMail.java:216)

Even I can read e-mails from this server using imap protocol.

Lets put all our knowledge in one place.

What could be the reason for it?

1. MS exchange server for sending uses another port than 25. What port is it? How can I setup it within Java application.

2. What userId format should be? domain\\windowsUserId\\First.LastNames where your Outlook address is First.LastNames@domain.com

3. Is that enough to use String hostIPAddress, userID, password to connect or it's reqiued to create PasswordAuthentication passwordAuthentication = new PasswordAuthentication(userID,password );
mailSession.setPasswordAuthentication(serverUrlName,passwordAuthentication);

4. What else We can try?

Igor Artimenko
Java Programmer
Xerox
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2009
Added on Oct 16 2001
5 comments
386 views