vikram_1982
asked on
sun.net.smtp.SmtpProtocolException: 550 error.. Have no idea what it is...
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.SmtpC lient, java.io.*" %>
<%
String from="myname@mydomain.com" ;
String to="recipient@recipientdom ain.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.SmtpPro tocolExcep tion: 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
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.SmtpC
<%
String from="myname@mydomain.com"
String to="recipient@recipientdom
try{
SmtpClient client = new SmtpClient("203.197.175.3"
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.SmtpPro
Note: 192.168.3.217 is my IP address behind the LAN.
Plz help me out.
Vikram.V
Either that, or you will have to authenticate on that mail server (with your email/password) before you try to send the mail...
Tim
Tim
ASKER
Okay, I have my id and password for this server. How do i include them in the code above??
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
Add the following line of code as shown below
SmtpClient client = new SmtpClient("203.197.175.3"
/*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
ASKER
Dheeraj,
I tried what u told me and this is the error message i got.. any idea??
"ERROR SENDING EMAIL:sun.net.smtp.SmtpPro tocolExcep tion: 252 2.5.2 Cannot VRFY user; try RCPT to attempt delivery (or try finger)"
I tried what u told me and this is the error message i got.. any idea??
"ERROR SENDING EMAIL:sun.net.smtp.SmtpPro
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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