email的问题,请大家和各位高手帮忙看看啊,为什么不能成功发送!

bbshero 2002-05-27 06:26:11
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<html>
<head>
<title>
mail
</title>
</head>
<body>
<h1>
JBuilder Generated JSP
</h1>
<%
String from="bbshero@sina.com";
String to="smsohu@sohu.com";
try{
SmtpClient client = new SmtpClient("smtp.21cn.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! :-)");
message.println();
message.println("Good Boy");
message.println("I'm in genius.com");
message.println();
client.closeServer();
}
catch (IOException e){
System.out.println("ERROR SENDING EMAIL:"+e);
}
%>
</body>
</html>
!谢谢
...全文
106 点赞 收藏 1
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
supershot 2002-05-28
用JAVAMAIL嘛,很好用的
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告