• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Error in sending mail through JSP using (SmtpClient)

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends,
I am trying to develop a FormMailer application using Servlets or JSP. I tried the thing by using the code mentioned below, but i am getting an error " sun.net.smtp:Sun.ProtocolException 550 5.7.7. Unable to relay to amits_007@rediffmail.com" on the DOS prompt and my browser screen doesnt show anything.I am using TOMCAT as the server and JSP as the front end.
CODE follows:
<%@ page language="java" import="sun.net.smtp.SmtpClient, java.io.*" %>
<% String from="amits_007@hotmail.com";
String to="amits_007@rediffmail.com";
try{ SmtpClient client = new SmtpClient("mail.yahoo.com");
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("Govind Seshadri");
message.println("jGuru.com");
message.println();
client.closeServer();
out.println("amirr");
}
catch (IOException e){ System.out.println("ERROR SENDING EMAIL:"+e); }%>

Kindly help me out with this. Please suggest if there is any other way by which this applicatin can be made.
Bye,
Amit
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mail.yahoo.com is not an SMTP mail host. It is the URL of a proprietary Web-based mail system. You do not have direct access to its outgoing mail capabilities with SMTP.
------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic