File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

Error in sending mail through JSP using (SmtpClient)

Rinku Sharma

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 " 550 5.7.7. Unable to relay to" 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=",*" %>
<% String from="";
String to="";
try{ SmtpClient client = new SmtpClient("");
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("Cool beans! :-)");
message.println("Govind Seshadri");
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.
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118 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="" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
I agree. Here's the link:
subject: Error in sending mail through JSP using (SmtpClient)
It's not a secret anymore!