Posted By:
Nilesh_Ghadigaonkar
Posted On:
Tuesday, April 4, 2006 01:40 AM
I am doing a project in which i want to send a mail using jsp.I tried the folloing code given on site of Jguru under title sending mail using jsp <%@ page import="sun.net.smtp.SmtpClient, java.io.*" %> <% String from="gseshad@hotmail.com"; String to="gov@jguru.com, govi@bigfoot.com"; try{ SmtpClient client = new SmtpClient("mail.xxxxx.xxx"); 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!"
More>>
I am doing a project in which i want to send a mail using jsp.I tried the folloing code given on site of Jguru under title sending mail using jsp
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="gseshad@hotmail.com";
String to="gov@jguru.com, govi@bigfoot.com";
try{
SmtpClient client = new SmtpClient("mail.xxxxx.xxx");
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);
}
%>
This gives error after client.from(from) line stating client can not be access this way
We had tried the java code which worked properly,but after incuding userid and password.(server do not allow to post mail directly.
I want to know how can i put userid and password in above jsp code
Thanks.
<<Less