去看看这个帖子。
http://expert.csdn.net/Expert/TopicView1.asp?id=1788894可以成功发信。
http://expert.csdn.net/Expert/TopicView1.asp?id=1788894可以成功发信。
解决方案 »
- 大家帮忙看一下 hibernate4.2加到web项目就报错,但是加到普通的java项目里有正常
- java.lang.ClassNotFoundException: com.gsms.servlet.RegisterServlet
- commons-httpclient包下的httpClient.executeMethod(postMethod)方法报错
- 上海招聘Java Web高级工程师(欢迎想跳槽的高手来面试)
- 请教JSP中数据库操作取不到SUM运算结果值的问题!!多谢!!!
- jspsmartupload下载的问题
- 今天看了一段代码,但运行是出现一个错误?
- 请问弹出一个文件选择框如何实现啊?
- 如何在同一页面上保存数据到数据库?
- 请问:如何计算两时间的时间差!?
- 有关org.apache.poi包
- window.open()弹出窗口标题怎么设?
另:你的text是怎么定义的?
Properties props = new Properties();
props.put("mail.smtp.host", accountValue.sendServer);
props.put("mail.smtp.auth","true");
Authenticator authenticator = new EmailAuthenticator(
accountValue.username,accountValue.password);
mailSession = Session.getInstance(props, authenticator);
store = mailSession.getStore(accountValue.receiveServerType);
store.connect(accountValue.receiveServer, accountValue.username,
accountValue.password);
//用户认证类
package cn.mail;import javax.mail.PasswordAuthentication;public class EmailAuthenticator extends javax.mail.Authenticator {
public EmailAuthenticator(String username,String password) {
setUsername(username);
setPassword(password);
}
private String username;
private String password;
public void setUsername(String username)
{
this.username = username;
}
public void setPassword(String password)
{
this.password = password;
}
public PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username,password);
}
}