• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Java mail failing on some machine

 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic