看你使用的包是否支持SMTP密码验证...如果支持,就会提供方法set用户名和密码,否则就是不支持。
解决方案 »
- 怎样用ActionContext获得application对象
- 求高人讲哈标签库
- 在hibernate中关于外键一对一的问题,如何设置呀,我看了半天的书,都不明白,请高手帮忙
- 打不开http://localhost:8080/
- commons-upload 上传文件怎么为空
- 怎样实现将数据从服务器端自动发送到客户端?
- 100分求购java与sql2000的连接池
- Hibernate 读取bean的配置meta信息,比如表列,精度,PKFK 非空默认等
- java存储过程出问题,如何解决呢?
- JSP文件做好后如何上传?
- 急啊,jsp页面跳转与换行问题
- 我做了个activex 。 怎么样实现客户端自动下载(包括注册安装)和判断版本并且自动更新。
String userName;
String userPassword; public SmtpAuthenticator(String userName, String userPassword) {
this.userName = userName;
this.userPassword = userPassword;
} protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication
(userName, userPassword);
}
}Properties props = System.getProperties();
props.put("mail.smtp.auth", "true");
SmtpAuthenticator sa = new SmtpAuthenticator("xxxxxx",
"123456");
session = Session.getDefaultInstance(props, sa);