对了。另外我的包只有activation-1.1.jar,mail.jar(mail.jar是官网下载的javamail-1_4.zip解压目录下的,不是lib目录里的)。我介绍的够全的吧。会的告诉下到底是怎么回事呀。。
解决方案 »
- hibernate进行多表查询每个表中各取几个字段,也就是说查询出来的结果集没有一个实体类与之对应如何解决?
- 大家帮我抉择一下?
- hibernate自关联的实现方式?
- iBatis 数据库连接问题
- 目前J2EE中最常用的开发工具是什么?
- 关于OJB查询数据问题
- 大侠请帮帮忙~!进来看一眼吧~!多谢~!
- 100分求解一个问题:目前java应用,开发客户端的多还是开发web的多?
- 求intellij idea 3.0 keygen
- 关于小程序中重复获取token的问题
- 弱弱的问一句
- 第一次做struts+hibernate+spring遇到这个问题Servlet action is not available
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.163.com", port 25, isSSL false
220 163.com Anti-spam GT for Coremail System (163com[20050206])
DEBUG SMTP: connected to host "smtp.163.com", port: 25
.
.
.
550 用户被锁定没人会吗????
public class SMTPAuth extends javax.mail.Authenticator{
private String user = null;
private String password = null;
/** Creates a new instance of SMTPAuth */
public SMTPAuth(String u, String p) {
this.user = u;
this.password = p;
}
protected javax.mail.PasswordAuthentication getPasswordAuthentication(){
return new javax.mail.PasswordAuthentication(this.user, this.password);
}
}其他的好像没什么问题:
Properties props = new Properties();
//Properties props = System.getProperties();
props.put("mail.smtp.host", ConnectDialog.smtpserver);
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.auth","true");
props.put("mail.smtp.port","25");
SMTPAuth auth = new SMTPAuth(ConnectDialog.user,ConnectDialog.pwd);
//设定发送邮件时需要进行身份验证
session = Session.getInstance(props,auth);
// session = Session.getDefaultInstance(props, auth);
session.setDebug(true);
Message newMessage = new MimeMessage(session);
newMessage.setFrom(new InternetAddress(getFrom()));
//newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(getTo()));
newMessage.setRecipients(Message.RecipientType.TO,address);//群发
newMessage.setSubject(getSubject());
newMessage.setSentDate(new java.util.Date());
newMessage.setText(getContent());// Transport transport = session.getTransport("smtp");
transport.connect (ConnectDialog.smtpserver,ConnectDialog.user,ConnectDialog.pwd);
transport.sendMessage(newMessage,newMessage.getAllRecipients());
transport.close();
我把我做的贴出来,希望对你有帮助。