?
Solved

sun.net.smtp.SmtpProtocolException: 550 error.. Have no idea what it is...

Posted on 2004-04-16
6
Medium Priority
?
2,393 Views
Last Modified: 2012-08-14
Hello,

I am writing a small scriptlet in jsp to send a mail to a specified email address. Here is the code...

<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
 String from="myname@mydomain.com";
 String to="recipient@recipientdomain.com";
 try{
     SmtpClient client = new SmtpClient("203.197.175.3"); //This is the SMTP server address
     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);
  }
%>


I am getting the following error:

ERROR SENDING EMAIL:sun.net.smtp.SmtpProtocolException: 550 5.7.1 <recipient@recipientdomain.com>... Relaying denied. IP name lookup failed [192.168.3.217]  

Note: 192.168.3.217 is my IP address behind the LAN.

Plz help me out.
Vikram.V
0
Comment
Question by:vikram_1982
  • 2
  • 2
  • 2
6 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 10840805
You are trying to force your email address as being something other than your address...

This is called "relaying", and was the biggest cause of spam...  Therefore, almost all public mail servers do not allow it (and those that do often get added to spam-blacklists)...

You will have to send the email from a mail server set up on your machine...

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 10840809
Either that, or you will have to authenticate on that mail server (with your email/password) before you try to send the mail...

Tim
0
 
LVL 2

Author Comment

by:vikram_1982
ID: 10840920
Okay, I have my id and password for this server. How do i include them in the code above??
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:dheerajbhat
ID: 10890445
Hi,
   Add the following line of code as shown below


     SmtpClient client = new SmtpClient("203.197.175.3"); //This is the SMTP server address
/*Add this code*/
      client.sendServer("VRFY youruserid");
/*till here*/
     client.from(from);

  It might still decline if some IP matching is done to validate relaying.And your
   client.from(from) statement may require your actual mail address(on the same server to which you are sending).

  Hope this solves your problem

Regards
Dheeraj Bhat

0
 
LVL 2

Author Comment

by:vikram_1982
ID: 10898863
Dheeraj,

I tried what u  told me and this is the error message i got.. any idea??

"ERROR SENDING EMAIL:sun.net.smtp.SmtpProtocolException: 252 2.5.2 Cannot VRFY user; try RCPT to attempt delivery (or try finger)"
0
 
LVL 1

Accepted Solution

by:
dheerajbhat earned 300 total points
ID: 10937535
Hi,
    It means that the userid you are using is not correct.Are you sure about that on the server you are trying.For example if my mailaddress is dheerajbhat@xyz.com my id might be dbhat.

looks like you dont have an id on that server.To confirm that,try to capture the server response by adding
client.sendServer("VRFY youruserid");
/*Add these lines*/
String response = client.getResponseString();
System.out.println("THE RESPONSE IS:"+response );
/*Till here*/
 client.from(from);

  If you get a response like 550,it means your userid is not verified.Please check that.

Best of luck
REgards
Dheeraj Bhat


0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Most folks would know the basics of how Dropbox works, so that’s not the purpose of this article. Security is what it’s all about, so here I’ll share how I choose to secure my Dropbox Account and the Data it contains.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses
Course of the Month14 days, 17 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question