Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to send mailSmtp protocol Exception

843790Dec 14 2006 — edited Dec 20 2006
i wrote the code for sending mail but iam unable to send mail.Iam
getting the following error please help me from this problem.
sun.net.smtp.SmtpProtocolException:
at sun.net.smtp.SmtpClient.issueCommand(SmtpClient.java:48)
at sun.net.smtp.SmtpClient.closeServer(SmtpClient.java:38)
at sun.net.NetworkClient.openServer(NetworkClient.java:117)
at sun.net.smtp.SmtpClient.openServer(SmtpClient.java:111)
at sun.net.smtp.SmtpClient.<init>(SmtpClient.java:156)
at com.nsc.aep.util.SendMail.mailTest(SendMail.java:14)
at com.nsc.aep.util.SendMail.main(SendMail.java:39)


: sun.net.smtp.SmtpProtocolException: 550 error.. llo,

I am writing a small scriptlet in jsp to send a mail to a specified email address. Here is the code...

<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="myname@mydomain.com";
String to="recipient@recipientdomain.com";
try{
SmtpClient client = new SmtpClient("203.197.175.3"); //This is the SMTP server address
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();
client.closeServer();
}
catch (IOException e){
System.out.println("ERROR SENDING EMAIL:"+e);
}
%>

thanx in advance

Message was edited by:
k-@.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2007
Added on Dec 14 2006
2 comments
197 views