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....:)-

[1544 byte] By [sure_2912a] at [2007-11-27 2:22:24]
# 1
Check out the JavaMail API. It provides an extensive and clear API to send mails by Java.
BalusCa at 2007-7-12 2:26:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...