wood burning stoves 2.0*
The moose likes Servlets and the fly likes Problem in sending mail using Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem in sending mail using Servlets" Watch "Problem in sending mail using Servlets" New topic

Problem in sending mail using Servlets

jeyaveera pandian
Ranch Hand

Joined: Sep 29, 2000
Posts: 39
We are encountring a problem while using sun.net.smtp.SmtpClient class.
For a given emailid ,the exception thrown is ,it is not able to relay on that id.
we're using SmtpClient s=new SmtpClient("yahoo.com");
actually,what this constructor implies? and why we are passing string argument to constructor.Whether it have any importance or not
Please send a solution for this
Jayson Falkner
Ranch Hand

Joined: May 07, 2001
Posts: 57
Where is this email package you are using coming from?
Taking a guess at your question the constructor looks like it wants a SMTP host. The issue with this can be one of many things but, usually it is one of these two. First the arguement is not even a SMTP host for you to use or second some SMTP hosts will only allow email to be sent from registered users.
eg: I work on JSP Insider. I can send email using my reply address as me@jspinsider.com . I cannot send email with the reply address you@hotmail.com . This is because the JSP Insider SMTP server will refuse to send mail from unknown senders(you@hotmail.com).
Your error is more then likely one of those two things. SMTP servers are the bane of email bliss. I would recommend you either set up your own or ask the server's administration what the deal is.
On a side note. Have you looked in to the JavaMail API? You will find much more support for this package including tag libraries and FAQs.
Jayson Falkner
V.P./CTO, Amberjack Software LLC

[This message has been edited by Jayson Falkner (edited May 08, 2001).]

Jayson Falkner<br />jayson@jspinsider.com<br />Author of <a href="http://www.jspbook.com" target="_blank" rel="nofollow">Servlets and JavaServer Pages; the J2EE Web Tier</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem in sending mail using Servlets