• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Error in sending mail through JSP using (SmtpClient)

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");
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("Cool beans! :-)");
message.println("Govind Seshadri");
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.
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
    Bookmark Topic Watch Topic
  • New Topic