Hi All, I have two Unix machines from which I run my Java Mail program. Now, one one machine it works even if I don't set mail.smtp.host property whereas on second machine it doesn't work if I don't set mail.smtp.host property. Does anybody know the reason? I want to avoid writing specific mail server name in the smtp host property as I move my code across different Unix hosts. I can put that property in a config file but I am just curious why it doesn't work on some machine (On most machines I have worked it worked...)... Regards Maulin
I played around with the JavaMail API and it looks like if you do not set the "mail.smtp.host" property that it defaults to "localhost", port 25. So it's possible that the mail server is set up differently on the two machines; one can send mail and one can not. That would explain the behaviour you are seeing. You got lucky since you are running on UNIX; most windows boxes aren't set up with an SMTP server listening on port 25. Unless you can depend on having the SMTP server running in an open mode, it's probably best to set up a properties file with the mail server name.
Poop goes in a willow feeder. Wipe with this tiny ad: