p.put("mail.smtp.auth","true");
Session ses = Session.getInstance(p, null);
你用了javax.mail.Authenticator类?定义一个对象继承它,把邮箱帐号和密码传进去,还要有一个get方法:public PasswordAuthentication getPasswordAuthentication(){
PasswordAuthentication pass = new PasswordAuthentication(this.mailUserName,this.mailPassword);
return pass;
}然后传到Session.getInstance(p, auth);
或者去掉这句试试:p.put("mail.smtp.auth","true");
Session ses = Session.getInstance(p, null);
你用了javax.mail.Authenticator类?定义一个对象继承它,把邮箱帐号和密码传进去,还要有一个get方法:public PasswordAuthentication getPasswordAuthentication(){
PasswordAuthentication pass = new PasswordAuthentication(this.mailUserName,this.mailPassword);
return pass;
}然后传到Session.getInstance(p, auth);
或者去掉这句试试:p.put("mail.smtp.auth","true");
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货