java邮件存储类型"imap"与"imaps"的对比 [英] java mail store type "imap" vs "imaps"
本文介绍了java邮件存储类型"imap"与"imaps"的对比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码以编程方式验证电子邮件.
I am using the following code to validate an email programatically.
Properties properties = new Properties();
Session emailSession = Session.getDefaultInstance(properties);
Store store = emailSession.getStore("imap");
store.connect(host, user, password);
if(store.isConnected()){
System.out.println("true");
}
当前会引发异常
javax.mail.MessagingException: Connection dropped by server?;
nested exception is:
java.io.IOException: Connection dropped by server?
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:670)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at com.**.channel.type.IMAPValidator.fetch(IMAPValidator.java:23)
at com.**.channel.type.IMAPValidator.main(IMAPValidator.java:47)
但是,如果我使用
emailSession.getStore("imaps");
然后成功连接到YAHOO的imap服务器.
then it successfully connects to imap server of YAHOO.
我所知道的"imaps"代表安全".
What i know "imaps" stands for "secure".
我不知道为什么我不能简单地使用"imap"?
What i dont know is why I cant simply use "imap"?
推荐答案
Google确实需要安全连接.
Google does require a secure connection.
https://support.google.com/mail/troubleshooter/1668960?hl = zh-CN#ts = 1665018%2C1665144
这篇关于java邮件存储类型"imap"与"imaps"的对比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文