JavaMail的安全认证
发表于:2007-06-11来源:作者:点击数:
标签:
//最近在教学 Java Mail时采用的username/password认证代码,zfluynu import java x.mail.*; public class MailAuthenticator extends Authenticator...{ String authenName; //用户名 String authenPass; //密码 public MailAuthenticator(String authenNam
//最近在教学JavaMail时采用的username/password认证代码,zfluynu import javax.mail.*; public class MailAuthenticator extends Authenticator...{
String authenName; //用户名
String authenPass; //密码 public MailAuthenticator(String authenName,String authenPass) ...{
super();
this.authenName=authenName;
this.authenPass=authenPass;
} public PasswordAuthentication getPasswordAuthentication()...{
//若服务器需要身份认证,Session会自动调用这个方法 return new PasswordAuthentication(authenName,authenPass);
}
}
|
(责任编辑 火凤凰 sunsj@51cto.com QQ:34067741 TEL:(010)68476636-8007)