在2018年调试Yahoo的IMAP访问 [英] Debugging IMAP access of Yahoo in 2018

查看:94
本文介绍了在2018年调试Yahoo的IMAP访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法通过Yahoo验证IMAP,也无法查明原因.除了以下例外情况,有人可以帮助我获取更多信息吗?

I am unable to authenticate IMAP with Yahoo and cannot pinpoint the cause. Can anyone help me to get more information other than the exception below?

"javax.mail.AuthenticationFailedException:[AUTHENTICATIONFAILED]无效的凭据(失败)"

"javax.mail.AuthenticationFailedException: [AUTHENTICATIONFAILED] Invalid credentials (Failure)"

多年来,雅虎似乎对身份验证进行了许多修订,因此这就是我将本年度放在标题中的原因.这是我的设置:

Yahoo seems to have had many revisions to authentication over the years so that is why I put the current year in the title. Here is my setup:

在Yahoo上:我启用了安全性较低的应用程序;我已经检查并重新检查凭据.

On Yahoo: I have enabled less secure apps; I have checked and recheck credentials.

在我的Linux机器上:我已经证明,通过使用Thunderbird连接和浏览邮件,IMAP可以工作.

On my linux box: I have proven that IMAP works by using Thunderbird to connect and browse mail.

这是代码:

  1  private static final String email_id = "xxxxxxxx@yahoo.com";
  2  private static final String password = {"xxxxxxxx"};
  3 
  4  public static void main(String[] args) {
  5  
  6    Properties properties = new Properties();
  7    //yahoo
  8    properties.put("mail.store.protocol",        "imap");
  9    properties.put("mail.imaps.host","imap.mail.yahoo.com");
 10    properties.put("mail.imaps.port",            "993");
 11    properties.put("mail.imap.ssl.enable",       "true");
 12    properties.put("mail.imap.mail.auth",        "true");
 13                          
 14    try {                 
 15       Session session = Session.getDefaultInstance(properties, null);
 16       Store store     = session.getStore("imaps");
 17       
 18       store.connect(email_id, password);
 19       
 20       ...
 21       
 22       store.close();
 23    } catch (Exception e) {
 24       e.printStackTrace();
 25    }  
 26  } // end of main
 27 }

推荐答案

找到了调试答案.包含对Session对象的调试.

Found the debugging answer. Included debugging on the Session object.

session.setDebug(true);

这篇关于在2018年调试Yahoo的IMAP访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆