Javamail 和 Gmail Pop3 SSL

Tob*_*bia 5 gmail pop3 jakarta-mail

我正在尝试将我的应用程序连接到 Gmail 以检查电子邮件。我必须对 POP3 使用 SSL。

这是我的代码:

    Properties props = new Properties();

    props.put("mail.host", "pop.gmail.com");
    props.put("mail.store.protocol", "pop3s");
    props.put("mail.pop3s.auth", "true");
    props.put("mail.pop3s.port", "993");

    Session session = Session.getDefaultInstance(props, null);
    Store store=session.getStore();
    store.connect("myuser@gmail.com","mypass");
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Exception in thread "main" javax.mail.MessagingException: Connect failed;
  nested exception is:
    java.io.IOException: Unexpected response: * OK Gimap ready for requests from x.x.x.x.x z50if25691877wef.13
    at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:210)
    at javax.mail.Service.connect(Service.java:295)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:196)
Run Code Online (Sandbox Code Playgroud)

我认为这有一个好消息:gmail 服务器回答了,但是......似乎对 javamail 的回答很糟糕。