Java post store like "imap" versus "imaps"

I use the following code to programmatically check email.

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"); } 

he is currently throwing an exception

 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) 

However, if I use

 emailSession.getStore("imaps"); 

then it successfully connects to the YAHOO IMAP server.

What I know, "imaps" means "safe."

What I don’t know, why I can’t just use "imap"?

+6
source share

Source: https://habr.com/ru/post/988432/


All Articles