wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes basic question about smtp server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "basic question about smtp server" Watch "basic question about smtp server" New topic
Author

basic question about smtp server

Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

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?

thnx for your time
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

thnx paul,

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.

thnx
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
Yahya Elyasse
Ranch Hand

Joined: Jul 07, 2005
Posts: 510

Excellent reply thnx !
this is the first time i'll be sending email from a jsp page..so bare with a poor newbie like me

here is the simple code i used from a jsp page :



now how can i add the part for authentication with my username and password provided by my ISP?
that would be nice if you provide some code because i'm still new to JavaMail.

thnx indeed.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Also: those free servers do exist. But they are usually "black-listed" by most services that scan e-mail messages for spam, so I don't recommend searching for them.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.

There's a good tutorial on JavaMail here:

http://java.sun.com/developer/onlineTraining/JavaMail/contents.html

(By the way, I don't keep that link in my browser or anything like that. I just open Google and type in "javamail tutorial". You will find that technique very useful for finding information.)
 
jQuery in Action, 2nd edition
 
subject: basic question about smtp server