• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Java mail failing on some machine  RSS feed

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...)...
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.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!