File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes SmtpClient Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "SmtpClient" Watch "SmtpClient" New topic
Author

SmtpClient

unna kumar
Greenhorn

Joined: Oct 13, 2000
Posts: 11
While sending mail using sun.net.smtp.SmtpClient
we have to specify the MAIL_HOST in the coding itself.
How can I change the host according to the
MAIL_TO address.Suppose if I want to mail to one ID
in yahoo eg. name@yahoo.com then the host should
be www.yahoo.com, like wise if it is name@rediffmail.com
then the host shold be www.rediff.com.
Please help how to change the host wihtout getting
as input filed.
Thanks
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
You should never need to change the mail host once you have one which works. Email is a distributed system, and each host will forward the message to the appropriate destination for you.
Try it.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
unna kumar
Greenhorn

Joined: Oct 13, 2000
Posts: 11
Thanks for reply.
SmtpClient ss=newSmtpClient("mail.yahoo.com")
Using the above code, can I send email to a person having
email address other than yahoo.com. i.e.(Mail_To: name@usa.net)
I have tried this.It was not working.
But you have said that email is a distributed system, and each
host will send that email to appropriate destination.
Please help out.
Thankx again.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
It may be that mail.yahoo.com won't forward emails. Keep looking until you find a mail host which will. How do you get your internet connection? Almost all ISPs provide a mail host as part of the service.
unna kumar
Greenhorn

Joined: Oct 13, 2000
Posts: 11
Sir , I am connecting net thru VSNL.
I will try using www.vsnl.com as mail host.
Hope this will work.
Thankyou very much.
shashank hiwarkar1
Greenhorn

Joined: Feb 11, 2001
Posts: 25
Correct me if I ma wrong........
Unna,

if u r using www.vsnl.com
then they are having their own mail host. You need to use that smtp host.
Now when you post anything@yahoo.com,
it will connect to the smtp host you specified.
That smtp host will connect to the gateway of the vsnl,through the routers.
Now ur request is at the gateway, this will distribute ur request depending on the address u specified, ie yahoo.
That means at the time of coading ur mail client u need to specify only ur smtp host.

Shashank


shashank
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I've looked through the help pages at www.vsnl.com , especially the one at http://www.vsnl.com/english/userguide/netscape.htm and they recommend that you set
your SMTP server (for outgoing messages) to: 202.54.1.18 and
your POP3 server (for incoming messages) also to: 202.54.1.18
Try that and see how you get on.
unna kumar
Greenhorn

Joined: Oct 13, 2000
Posts: 11
Thank You very much for your
immediate response.
Unna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SmtpClient
 
Similar Threads
What's wrong here..
Applications of Portal/portlet in the industry
java.net.URL binding to JNDI in weblogic & use in EJB
How to create image of given URL?
Relative URLs