Hi,
I want to send an mail using JSP.
I have a code like that
It runs without any error and also didn't receive the mails .
plz tell that whats the problem in my code.
I want to send an mail using JSP.
I have a code like that
Code:
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="eminosoft.sravani@gmail.com";
String to="eminosoft.sravani@gmail.com";
try{
SmtpClient client = new SmtpClient("localhost");
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);
}
%>
plz tell that whats the problem in my code.
Comment