I am trying to send a mail through JavaMail but I am getting an exception: Could not connect to SMTP host: localhost, port: 25;
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   daniela_popescu
Posted On:   Monday, March 11, 2002 01:40 AM


I use:

Properties props = System.getProperties();

props.put("mail.smtp.host",smtpHost);

Session session = Session.getDefaultInstance(props, null);

.............
...........
I set smtpHost with 'aaa.aaa.com'
and the error is:
could not connect to SMTP host: localhost, port: 25

why localhost ?
I don't use localhost in my smtpHost

Thanks!

Re: I am trying to send a mail through JavaMail but I am getting an exception: Could not connect to SMTP host: localhost, port: 25;

Posted By:   Fabio_Moratti  
Posted On:   Monday, April 8, 2002 05:29 AM

I've had a similar problem.

The following worked for me:





Properties props = new Properties();

props.put("mail.smtp.host", host);
props.put("mail.host",host);

Session ses = Session.getInstance(props, null);




The two properties are probably redundant but one seemed to
work in some contexts and the other in others, so I always put both just to be sure...!


Unfortunaltely I do not understand why this setting works
and your (that is cited il all the examples and tutorial) don't.

Any ideas out there?!?

Re: I am trying to send a mail through JavaMail but I am getting an exception: Could not connect to SMTP host: localhost, port: 25;

Posted By:   John_Zukowski  
Posted On:   Monday, March 11, 2002 06:20 AM

It seems to be ignoring your setting. Perhaps you either have a typo in your property name or you aren't setting the variables properly. Try replacing the smtpHost variable with the server you want directly. Remove the one level of indirection.
About | Sitemap | Contact