Sending mail using SMTP server
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   sheeba_PH
Posted On:   Monday, August 12, 2002 06:42 AM

Am getting sendFailedExce Exception in thread "main" javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused: no further information at javax.mail.Transport.send0(Transport.java:218) at javax.mail.Transport.send(Transport.java:80) at ListServer.postMail(ListServer.java:232) at ListServer.main(ListServer.java:59) My system is in a network and connected to the proxy server which is connected to the mail server. In my code I hv done props.put("mail.smtp.host", _smtpHost   More>>

Am getting sendFailedExce
Exception in thread "main" javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused: no further information
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at ListServer.postMail(ListServer.java:232)
at ListServer.main(ListServer.java:59)

My system is in a network and connected to the proxy server
which is connected to the mail server.

In my code I hv done
props.put("mail.smtp.host", _smtpHost ); the _smtphost is send by a command line argument.But in the exception it's trying to connect local host?Whats the reason? When I try telnet PDC1 25 I'm getting th message SMTP server ready.PDC1 is our http proxiserver which is connected mailserver.
All help will be appreciated.Thanks in advance.

Rgds,
Sheeba

   <<Less

Re: Sending mail using SMTP server

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, August 12, 2002 06:53 AM

In my code I hv done props.put("mail.smtp.host", _smtpHost ); the _smtphost is send by a command line argument.But in the exception it's trying to connect local host?



OK, so you have not taken "debugging 101" yet, I guess (sorry for being grumpy, it's a rainy Monday morning).



So, in your program, just as in any other program in any other computer language, here's how you start debugging code like this: you print out (to stderr or log or whatever) the value of "_smtpHost" which you are actually providing at runtime to "props.put". Now see how that compares, with what you think you are getting, and proceed from there.

About | Sitemap | Contact