看者有分... http://www.netyi.net/in.asp?id=lockllb//大量的教程!几乎包含了有关于计算机的一切!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@ page contentType="text/html;charset=gb2312" %><%@ page import="javax.mail.*"%><%@ page import="javax.mail.internet.*"%><%@ page import="javax.activation.*"%> <%@ page import="java.util.*"%> <HTML> <head> <TITLE>JSP meets JavaMail, what a sweet combo.</TITLE><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></HEAD><BODY> <%! //byte[] subjectTemp= request.getParameter("Subject").getBytes("ISO8859_1"); public class PopupAuthenticator extends Authenticator { public PasswordAuthentication getPasswordAuthentication() { String username, password; username = "user"; password = "pass"; return new PasswordAuthentication(username, password); } } %><%! public String toChi(String input) { try { byte[] bytes = input.getBytes("ISO8859-1"); return new String(bytes); } catch(Exception ex) { } return null;}%><% try{ String name = request.getParameter("Name"); String subject = request.getParameter("Subject"); String Hi=request.getParameter("Body"); byte[] tmpbyte=Hi.getBytes("ISO8859_1"); Hi=new String(tmpbyte); // out.print(Hi); //String body = (request.getParameter("Body").getBytes("ISO8859-1")); Properties props = new Properties(); Session sendMailSession; Store store; Transport transport; props.put("mail.smtp.host","yourhost"); props.put("mail.smtp.auth","true"); Authenticator auth = new PopupAuthenticator(); sendMailSession = Session.getInstance(props,auth); sendMailSession.setDebug(true); Message newMessage = new MimeMessage(sendMailSession); newMessage.setFrom(new InternetAddress("frommail")); newMessage.setRecipient( Message.RecipientType.TO, new InternetAddress("tomail")); newMessage.setSubject(subject); newMessage.setSentDate(new Date()); //String body = ("hello are you你好啊.?"); newMessage.setText(Hi); transport = sendMailSession.getTransport("smtp"); transport.send(newMessage); %><P>Your mail has been sent.</P><% } catch(MessagingException m) { out.println(m.toString());} %></BODY> </HTML>这是代码.如果到那里也有分送.解决一起结贴. 为什么网上的很多空间都不支持spring框架? filter的原理是怎样的 关于天乙社区在internet上发布的问题 速卖通api 调用 Tomcat + jconnect5.5 + sybase11.5字符集问题,我要疯!!!高手请入内 如何连接sqlserver editplus的配置问题 关于手机扫描二维码疑惑 hibernate查一个表的其中几个字段的问题 会stream上传插件 断点续传功能 请问这个功能如何实现? jspSmartUpload下载中文名文件的解决办法!(高分相求)在线等!急
<%@ page import="javax.mail.*"%>
<%@ page import="javax.mail.internet.*"%>
<%@ page import="javax.activation.*"%>
<%@ page import="java.util.*"%>
<HTML>
<head> <TITLE>JSP meets JavaMail, what a sweet combo.</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<BODY>
<%!
//byte[] subjectTemp= request.getParameter("Subject").getBytes("ISO8859_1");
public class PopupAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication() {
String username, password;
username = "user";
password = "pass";
return new PasswordAuthentication(username, password);
}
}
%>
<%!
public String toChi(String input)
{
try
{
byte[] bytes = input.getBytes("ISO8859-1");
return new String(bytes);
}
catch(Exception ex)
{
}
return null;
}
%><%
try{
String name = request.getParameter("Name");
String subject = request.getParameter("Subject");
String Hi=request.getParameter("Body");
byte[] tmpbyte=Hi.getBytes("ISO8859_1");
Hi=new
String(tmpbyte);
// out.print(Hi); //String body = (request.getParameter("Body").getBytes("ISO8859-1"));
Properties props = new Properties();
Session sendMailSession; Store store;
Transport transport;
props.put("mail.smtp.host","yourhost");
props.put("mail.smtp.auth","true");
Authenticator auth = new PopupAuthenticator();
sendMailSession = Session.getInstance(props,auth);
sendMailSession.setDebug(true);
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress("frommail"));
newMessage.setRecipient(
Message.RecipientType.TO, new InternetAddress("tomail"));
newMessage.setSubject(subject);
newMessage.setSentDate(new Date());
//String body = ("hello are you你好啊.?");
newMessage.setText(Hi);
transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
%>
<P>Your mail has been sent.</P>
<%
} catch(MessagingException m) {
out.println(m.toString());
}
%>
</BODY>
</HTML>
这是代码.如果到那里也有分送.解决一起结贴.