求教javamail收yahoo邮件问题

07-07-18 hai522
我在坐一个实验用javamail接收yhaoo的邮件,为什么会出现这种问题,请指教,谢谢.

连接邮件服务器代码部分为:

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";

// Get a Properties object

Properties props = System.getProperties();

props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);

props.setProperty("mail.pop3.socketFactory.fallback", "false");

props.setProperty("mail.pop3.port", "995");

props.setProperty("mail.pop3.socketFactory.port", "995");

//以下步骤跟一般的JavaMail操作相同

Session session = Session.getDefaultInstance(props,null);

URLName urln = new URLName("pop3","pop.mail.yahoo.com.cn",995,null,

"帐号", "密码");

Store store = session.getStore(urln);

Folder inbox = null;

try {

store.connect();

.......

出现这种问题:下面的是调试时的报错

DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc]

DEBUG POP3: connecting to host "pop.mail.yahoo.com.cn", port 995, isSSL false

S: +OK hello from popgate on pop102.mail.cnb.yahoo.com 2.38.1

C: USER XXXX

S: +OK password required.

C: PASS XXXX

S: -ERR Error logging in. Please visit http://mail.yahoo.com

C: QUIT

S: EOF

Exception in thread "main" javax.mail.AuthenticationFailedException: Error logging in. Please visit http://mail.yahoo.com

at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:146)

at javax.mail.Service.connect(Service.java:275)

at javax.mail.Service.connect(Service.java:156)

at javax.mail.Service.connect(Service.java:105)

at MailFetch.main(MailFetch.java:32)

请不吝赐教,谢谢!我的邮箱是yh200507@yahoo.com.cn

banq
2007-07-25 12:36
AuthenticationFailedException,授权错误。没看到你设置POP3的用户名和密码

现在Yahoo可以通过POP收取邮件了?

猜你喜欢