Hi dhiraja,
Here iam giving you the related code. I hope this will help you out.
%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="xyzabc@rediffmail.com";
String to="abc@sun.com, hi@yahoo.com";
try{
SmtpClient client = new SmtpClient("mail.1234.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(" be Cool ");
message.println();
message.println("xyzabc");
message.println("sun.com");
message.println();
client.closeServer();
}
catch (IOException e){
System.out.println("error sending email:"+e);
}
%>
Regards,
Tirumalarao
Developer Technical Support,
Sun Microsystems,India.