• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java mail failing on some machine  RSS feed

 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!