how to code a function to send an email to a predetermine email address.
I developt a sample but i got som error message due to mailhost .
the error is showen in attached file.
can anyone say me how to solve this problem. i tried several mailhost, but it was useless.
the code i wrote is :
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="myemail@hotmail.com";
String to="myemail@gmail.com";
try{
SmtpClient client = new SmtpClient("mail.gmail");
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);
}
%>