在jsp在用sun.net.smtp.SmtpClient发送邮件出现如下错误。。。 ( 积分: 100 )

  • 主题发起人 主题发起人 寻找
  • 开始时间 开始时间

寻找

Unregistered / Unconfirmed
GUEST, unregistred user!
ERROR SENDING EMAIL:sun.net.smtp.SmtpProtocolException: 501 input error.
程序:
<%@ page import=&quot;sun.net.smtp.SmtpClient, java.io.*&quot;
%>
<%
String from=&quot;glint530@163.com&quot;;
String to=&quot;glintstar@21cn.com&quot;;
try{
SmtpClient client = new SmtpClient(&quot;10.0.0.200&quot;);
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println(&quot;To: &quot;
+ to);
message.println(&quot;Subject: Sending email from JSP!&quot;);
message.println(&quot;This was sent from a JSP page!&quot;);
message.println();
message.println(&quot;Cool beans! :-)&quot;);
message.println();
message.println(&quot;Govind Seshadri&quot;);
message.println(&quot;jGuru.com&quot;);
message.println();
client.closeServer();
}
catch (IOException e){
out.println(&quot;ERROR SENDING EMAIL:&quot;+e);
}
%>
10.0.0.200是局域网内的邮件服务器
 
ERROR SENDING EMAIL:sun.net.smtp.SmtpProtocolException: 501 input error.
程序:
<%@ page import=&quot;sun.net.smtp.SmtpClient, java.io.*&quot;
%>
<%
String from=&quot;glint530@163.com&quot;;
String to=&quot;glintstar@21cn.com&quot;;
try{
SmtpClient client = new SmtpClient(&quot;10.0.0.200&quot;);
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println(&quot;To: &quot;
+ to);
message.println(&quot;Subject: Sending email from JSP!&quot;);
message.println(&quot;This was sent from a JSP page!&quot;);
message.println();
message.println(&quot;Cool beans! :-)&quot;);
message.println();
message.println(&quot;Govind Seshadri&quot;);
message.println(&quot;jGuru.com&quot;);
message.println();
client.closeServer();
}
catch (IOException e){
out.println(&quot;ERROR SENDING EMAIL:&quot;+e);
}
%>
10.0.0.200是局域网内的邮件服务器
 
jsp為什麼不到csdn問呢,這個問題我不懂
 
接受答案了.
 
后退
顶部