How to send mail through SMTP..
Hi all,
I wolud like to send mails through SMTP. But i am fail to write a program. I try my level best. Can anybody help with in this topic please. I write a program like this:
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="admin@mysite.com";
String to="suresh@yahoo.com";
String Server ="smtp.mysite.com";
try
{
SmtpClient client =new SmtpClient("Server");
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);
}
%> <jsp:forward page="success.jsp"/>
with Regards
sure....:)-

