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");
}
currently it throws 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 imap server of YAHOO.
What i know "imaps" stands for "secure".
What i dont know is why I cant simply use "imap"?
Google does require a secure connection.
https://support.google.com/mail/troubleshooter/1668960?hl=en#ts=1665018%2C1665144
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With