CSDN博客

img stefli

我的Java学习路二:邮件发送

发表于2004/10/14 21:21:00  922人阅读

<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="**@**.com";
String to=**@**.com;
try{
SmtpClient client = new SmtpClient("mail.**.**");
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);
}
%>
阅读全文
0 0

相关文章推荐

img
取 消
img