Javax Mail - 无法连接到电子邮件服务器

时间:2016-08-04 08:02:46

标签: java javamail

我有以下代码:

Properties props = new Properties();
    props.put("mail.pop3.host", "pop.1und1.de");
    props.put("mail.pop3.user", "xxxx");
    // Start SSL connection
    props.put("mail.pop3.socketFactory", 995);
    props.put("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    props.put("mail.pop3.port", 995);

    Session session = Session.getDefaultInstance(props, new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication("xxxx", "xxxx");
        }
    });

    try {

        Store store = session.getStore("pop3");
        store.connect("pop.1und1.de", "xxxx", "xxxx");

        Folder folderInbox = store.getFolder("INBOX");

[...]

我想连接到' 1und1'服务器。但是它已经不能用了。我无法连接到我的电子邮件服务器。

这是错误:

  

javax.mail.AuthenticationFailedException:套接字上的EOF   com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:209)at at   javax.mail.Service.connect(Service.java:386)at   javax.mail.Service.connect(Service.java:245)at   de.beans.webservice.KoordinationsBean.downloadEmailAttachments(KoordinationsBean.java:990)     在   de.beans.webservice.KoordinationsBean.emailsLesen(KoordinationsBean.java:278)     在   de.beans.webservice.KoordinationsBean.starteTransition(KoordinationsBean.java:243)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     在   sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     在java.lang.reflect.Method.invoke(Method.java:498)at   com.sun.el.parser.AstValue.invoke(AstValue.java:289)at at   com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)     在   org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)     在   org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)     在   org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)     在   org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)     在   javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:149)     在javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)     在   javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:814)     在javax.faces.component.UICommand.broadcast(UICommand.java:300)at   javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)     在   javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)     在   com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)     在com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)at   com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)     在javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)at   org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)     在   org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:305)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)     在   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)     在   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)     在   org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)     在   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)     在com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)at   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)     在   org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)     在   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)     在   com.sun.enterprise.v3.services.impl.ContainerMapper $ HttpHandlerCallable.call(ContainerMapper.java:459)     在   com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)     在   org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)     在   org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)     在   org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)     在   org.glassfish.grizzly.filterchain.ExecutorResolver $ 9.execute(ExecutorResolver.java:119)     在   org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)     在   org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)     在   org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)     在   org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)     在   org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)     在   org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:526)     在   org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)     在   org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)     在   org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access $ 100(WorkerThreadIOStrategy.java:56)     在   org.glassfish.grizzly.strategies.WorkerThreadIOStrategy $ WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)     在   org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:591)     在   org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.run(AbstractThreadPool.java:571)     在java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案