我有 PAC 文件和代理端口,但无法登录和阅读 GMail 邮件。谁能告诉我如何在 JAVAMAIL API 中使用 PAC 和代理端口。我已经完成了类似的设置
propsIMAP = new Properties();
propsSMTP = new Properties();
propsIMAP.setProperty("http.proxyHost", "http-proxy01.domain.com");
propsIMAP.setProperty("http.proxyPort", "88");
propsIMAP.put("mail.imap.starttls.enable","true");
propsIMAP.put("mail.imap.host", ImapServerName);
propsIMAP.put("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
propsIMAP.put("mail.imap.socketFactory.fallback", "false");
propsIMAP.put("mail.transport.protocol", "imaps");
propsIMAP.put("mail.imap.auth", "true");
propsIMAP.put("mail.imaps.port", "993");
并得到错误:
DEBUG IMAP: mail.imap.fetchsize: 16384
DEBUG IMAP: mail.imap.ignorebodystructuresize: false
DEBUG IMAP: mail.imap.statuscachetimeout: 1000
DEBUG IMAP: mail.imap.appendbuffersize: -1
DEBUG IMAP: mail.imap.minidletime: 10
DEBUG IMAP: enable STARTTLS
DEBUG IMAP: trying to connect to host "webmail.gmail.com", port 993, isSSL false
javax.mail.MessagingException: webmail.gmail.com;
nested exception is:
java.net.UnknownHostException: webmail.gmail.com
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:670)