javamail中smtp服务器如何设置?

muzhi007 2003-05-23 06:57:41
我用props.put("mail.smtp.host","smtp.163.com");
props.put("mail.smtp.auth","true");

用户名和密码用的是在163中申请的邮箱的用户名和密码,对不对?
为什么总出现异常AuthenticationFailedException呢
是不是需要另申请SMTP?
请帮忙!
...全文
90 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyxsgq 2003-07-15
  • 打赏
  • 举报
回复
// Create empty properties
Properties props = new Properties();
//props.put("mail.pop3.host", "");
// Get session
Session session = Session.getDefaultInstance(props, null);
//System.out.print("fgd555");
// Get the store
Store store = session.getStore("pop3");
store.connect(host, username, password);
cgsun 2003-05-24
  • 打赏
  • 举报
回复
SmtpAuth sa=new SmtpAuth();
sa.getuserinfo("xxxx","xxxxx");
java.util.Properties props=new java.util.Properties();
props.put("mail.smtp.auth","true");
props.put("mail.smtp.host",smtpHost);



static class SmtpAuth extends javax.mail.Authenticator {
private String user,password;

public void getuserinfo(String getuser,String getpassword){
user = getuser;
password = getpassword;
}
具体参见http://expert.csdn.net/Expert/topic/1668/1668839.xml?temp=.169964
muzhi007 2003-05-23
  • 打赏
  • 举报
回复
怎么用不需验证啊
netnice 2003-05-23
  • 打赏
  • 举报
回复
163.COM需要身份验证才可以发的。

所以不行了

也许javamail支持验证,不过我还没试过,我就用不需要验证的法成功。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧