Javamail 和 Gmail Pop3 SSL [英] Javamail and Gmail Pop3 SSL
本文介绍了Javamail 和 Gmail Pop3 SSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将我的应用程序连接到 Gmail 以检查电子邮件.我必须为 POP3 使用 SSL.
i'm trying to connect my app to Gmail to check emails. I must use SSL for POP3.
这是我的代码:
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");
我得到这个错误:
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)
我认为这有一个很好的新功能:gmail 服务器已回答,但是...对于 javamail 的回答似乎很糟糕.
I think this has a good new: the gmail server answered, however... seems to answer in a bad way for javamail.
推荐答案
gmail的端口应该是995:http://support.google.com/mail/bin/answer.py?hl=zh-CN&answer=13287
The port should be 995 for gmail: http://support.google.com/mail/bin/answer.py?hl=en&answer=13287
这篇关于Javamail 和 Gmail Pop3 SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文