1

What I am trying to do is connect to hotmail to read the emails there. Have had a good read through Stack Overflow but still hitting a brick wall.

Based on what I have read so far I think the following should work.

String host = "pop3.live.com";
String username = "wibbletest123@hotmail.com";
String password = "Testing123";
String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
Properties pop3Props = new Properties();
pop3Props.setProperty("mail.pop3s.port", "995");
pop3Props.setProperty("mail.pop3.ssl.enable", "true");
pop3Props.setProperty("mail.pop3s.socketFactory.class", SSL_FACTORY);
pop3Props.setProperty("mail.pop3s.socketFactory.fallback", "false");
pop3Props.setProperty("mail.pop3s.port", "995");
pop3Props.setProperty("mail.pop3s.socketFactory.port", "995");

Session session = Session.getInstance(pop3Props, null);
Store store = session.getStore("pop3s");
store.connect(host, 995, username, password);

But what I get instead is

Exception in thread "main" javax.mail.AuthenticationFailedException: Logon failure: unknown user name or bad password.
    at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:146)
    at javax.mail.Service.connect(Service.java:275)
    at rsp.hotMail.EmailReader.main(EmailReader.java:28)

Which makes no sense as I have literally just created the hotmail account called wibbletest123@hotmail.com with the password Testing123

  • connecting and authenticating to pop3.live.com. Make sure to enable POP3 access from your account. – Amol Raje May 15 '18 at 07:02
  • enabled for you just try agin.. – Amol Raje May 15 '18 at 07:06
  • The general Hotmail instructions are in the [JavaMail FAQ](https://javaee.github.io/javamail/FAQ#hotmail). Also be sure to fix these [common JavaMail mistakes](https://javaee.github.io/javamail/FAQ#commonmistakes). – Bill Shannon May 15 '18 at 17:08
  • 1
    Thanks for all the comments and pointer to JavaMail stuff - and as Amol pointed out I needed to enable POP3 access to my hotmail account. Note for anybody reading this open hotmail in a browser - click on the little gear symbol (top right corner of screen) and under Options ! POP and IMAP you can let devices and apps use POP. – Richard Peters May 18 '18 at 22:41

0 Answers0