Hi, I succeeded to send email from a jsp page using the smtp server provided by my ISP... Now i will give my web jsp application to another person who will run it on his own machine with surely different ISP and country. my question is : would it work for him as it worked on my machine.
i didn't used any authentication for smtp server just the host name.
is it mandatory to use authentication (username and password ) provided by my isp?
That other person will have to ask their ISP that. It is very likely they will have to use authentication, but the answer depends on how the other person's network is configured and how their ISP's network is configured. And on their ISP's policies regarding spam prevention.
so probably a solution is to use a free email service that doesn't use authentication and security limitations . right ? do you know of such free email servers ? or maybe do you have another solution to this issue.
No. The solution is to use a professional ISP and authenticate yourself to it. If you can't do that then you shouldn't be using computers to generate e-mail messages.
There's a thing called "spam". I am sure you have heard of it. Now, if you are running an SMTP server then it needs to be visible to the Internet, so that other SMTP servers can communicate with it. But if it's visible to the Internet then everybody in the world can communicate with it, and ask it to send e-mail messages on their behalf. That's why they ask you to authenticate yourself.
And, if you try to "work around" that requirement by some trick, many SMTP servers will see that trick and decide your e-mail messages are spam. You don't want that to happen.
If your ISP didn't require you to authenticate yourself, that's possibly because your computer was actually part of the ISP's network, and you had to do some other authentication to make that happen. That commonly happens if you're connecting via dialup.
That "SmtpClient" class actually isn't part of JavaMail. I think it is an undocumented class in one of the "sun.*" packages, which you shouldn't be using because (a) they are undocumented and (b) they aren't guaranteed to exist in future releases of Java.