Sending email from a JSP page. (Its urgent)
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mohammed_Shareefuddin
Posted On:   Sunday, May 18, 2008 04:10 AM

Hello, Please help me in resolving the issue while sending a email from a JSP page. I am using the below code to send an email: <%@ page import="sun.net.smtp.SmtpClient, java.io.*" %> <% String from="shareef0.53@gmail.com"; String to="shareef@ab-sol.net"; String server="mail.ab-sol.net"; try{ SmtpClient client = new SmtpClient(server); client.from(from); client.to(to); PrintStream message = client.startMessage(); message.println("From: " + from); message.println("Subject: Sending email from JSP!"); message.println("This was sent from a jsp page!");    More>>

Hello,

Please help me in resolving the issue while sending a email from a JSP page.

I am using the below code to send an email:


<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="shareef0.53@gmail.com";
String to="shareef@ab-sol.net";
String server="mail.ab-sol.net";
try{
SmtpClient client = new SmtpClient(server);
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("From: " + from);
message.println("Subject: Sending email from JSP!");
message.println("This was sent from a jsp page!");
message.println("To: " + to);
message.println();
message.println("Cool beans! :-)");
message.println();
message.println();
out.println("successfully sent");
client.closeServer();
}
catch (IOException e){
System.out.println("ERROR SENDING EMAIL:"+e);
}
%>



But I am getting the following error message:

ERROR SENDING EMAIL:sun.net.smtp.SmtpProtocolException: 554 Sending address not accepted due to spam filter

Please help me in sending email.
Thank you.

   <<Less
About | Sitemap | Contact