javamail - java mail api javax.mail.MessageException Connect failed pop3 -
i want read mails user account using java mail api.
the mail server particular mail server:
reademail.java - client
properties props = system.getproperties(); props.put("mail.debug", "true"); props.put("mail.pop3.host", host); props.put("mail.pop3.port", port); props.put("mail.pop3.user", username); props.put("mail.pop3.timeout", "158000"); props.put("mail.pop3.connectiontimeout", "158000"); /* create session , store read mail. */ session = session.getinstance(props); store = session.getstore("pop3"); session.setdebug(true); store.connect(host,username, password);
the error message on client side:
debug pop3: mail.pop3.apop.enable: false debug pop3: mail.pop3.disablecapa: false debug pop3: connecting host "localhost", port 4444, isssl false s: +ok mail server ready c: capa s: javax.mail.messagingexception: connect failed; nested exception is: java.io.ioexception: unexpected response: @ com.sun.mail.pop3.pop3store.protocolconnect(pop3store.java:210) @ javax.mail.service.connect(service.java:295) @ javax.mail.service.connect(service.java:176) @ com.mail.reader.mailreader.connect(mailreader.java:67) @ com.mail.reader.testmailreader.main(testmailreader.java:21) caused by: java.io.ioexception: unexpected response: @ com.sun.mail.pop3.protocol.readresponse(protocol.java:752) @ com.sun.mail.pop3.protocol.multilinecommand(protocol.java:766) @ com.sun.mail.pop3.protocol.capa(protocol.java:675) @ com.sun.mail.pop3.protocol.<init>(protocol.java:140) @ com.sun.mail.pop3.pop3store.getport(pop3store.java:261) @ com.sun.mail.pop3.pop3store.protocolconnect(pop3store.java:206) ... 4 more
given seems complain unexpected response capa, might mail server sends non-standard response. try setting mail.pop3.disablecapa
true, won't send capa.
as aside system.getproperties();
returns shared properties object, not sure if that's intented. maybe new properties();
instead?
Comments
Post a Comment