The only way is by contacting the server admin and asking. Yahoo, GMail or Hotmail will probably have an FAQ which tells you the server details and rules about how to connect; you will have to search these sites to find out though.
A piece of advice if you are new to JavaMail: download your own SMTP server (
James for example) or use a
test harness (
Dumbster) and develop against this till you are
sure your code works exactly as expected. Some people find configuring JavaMail to work with a remote SMTP server difficult, so its good to know when you have to deal with this that its not your code which is to blame. Good luck.