This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Error in sending mail through JSP using (SmtpClient) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error in sending mail through JSP using (SmtpClient)" Watch "Error in sending mail through JSP using (SmtpClient)" New topic
Author

Error in sending mail through JSP using (SmtpClient)

Rinku Sharma
Greenhorn

Joined: Mar 30, 2001
Posts: 18
hi friends,
I am trying to develop a FormMailer application using Servlets or JSP. I tried the thing by using the code mentioned below, but i am getting an error " sun.net.smtp:Sun.ProtocolException 550 5.7.7. Unable to relay to amits_007@rediffmail.com" on the DOS prompt and my browser screen doesnt show anything.I am using TOMCAT as the server and JSP as the front end.
CODE follows:
<%@ page language="java" import="sun.net.smtp.SmtpClient, java.io.*" %>
<% String from="amits_007@hotmail.com";
String to="amits_007@rediffmail.com";
try{ SmtpClient client = new SmtpClient("mail.yahoo.com");
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("Subject: Sending email from JSP!");
message.println("This was sent from a JSP page!");
message.println();
message.println("Cool beans! :-)");
message.println();
message.println("Govind Seshadri");
message.println("jGuru.com");
message.println();
client.closeServer();
out.println("amirr");
}
catch (IOException e){ System.out.println("ERROR SENDING EMAIL:"+e); }%>

Kindly help me out with this. Please suggest if there is any other way by which this applicatin can be made.
Bye,
Amit
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
mail.yahoo.com is not an SMTP mail host. It is the URL of a proprietary Web-based mail system. You do not have direct access to its outgoing mail capabilities with SMTP.
------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets


Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in sending mail through JSP using (SmtpClient)
 
Similar Threads
problem in socket connection
How to send an email thro' Jsp
how to send a mail from a jsp?
Sending an email in JSP
I'm trying to make my code send me email - pliz help.