Hi. I have an account on Lycos.com, and I want to send an email to it through my Java class. I know, I have to set the mail.smtp.host property. but how can I know lycos's smtp host ? is there a specific syntax for all mail providers , like : mail.smtp.yahoo.com or smtp.yahoo.com ?? and if I am behind a proxy, what should I do ? ---------- another question please: when we use our mail accounts, and we want to send an email we write in the specific fields: FROM : email@example.com TO : firstname.lastname@example.org, email@example.com, firstname.lastname@example.org then we press Send button to send the mail. how the mail application knows each mail.smtp.host property for each provider ?
You only need to know of a single SMTP server that YOU are allowed to send mail through. That SMTP server figures everything else out. Usually this SMTP server is provided to you by your ISP. For example, if you use Earthlink to get online, it might be smtp.earthlink.com. I use RoadRunner in NC so mine is smtp-server.nc.rr.com. BUT...I can only use this SMTP server when I am on the RR network - if I try it from work, it will fail - this helps prevent SPAMmers form using/abusing it. So, to sum it up, you just need one SMTP server you are allowed to send mail through. All the rest of the details are handled behind the scenes. I did some email in my free (and open source once I get around to posting the code) app nator - http://nator.filenabber.com and I used the emai llibrary from coolservlets.com - http://coolservlets.com/Email/ - small, simple, easy to use, and it works. brian
Ask Lycos (or examining it from the header of an email sent from Lycos might work)
how the mail application knows each mail.smtp.host property for each provider ?
It doesn't need to - think about it, imagine the size of your application's SMTP Properties if it had to know this and be able to send emails to every domain in the world. Just find out the addres of one SMTP server and let its implementation of SMTP take care of the rest.
and if I am behind a proxy, what should I do ?
If its a simple HTTP web proxy, give up. If its a SOCKS v4 or v5 which allows anonomous connections, configure your JVM to send all TCP socket connecitons to this server (something like java -DsocksProxyHost=proxyServerName).