Java Mail阅读邮件

时间:2017-02-06 09:57:38

标签: java swing email client

我尝试使用JavaMail阅读邮件时收到此错误。请让我知道如何解决此错误:

我的部分代码:

referhEmail();
    }

    private void referhEmail(){
         try {
        Properties props = new Properties();  
        props.setProperty("mail.store.protocol", "pop3");      
        props.setProperty("mail.pop3.port", "110");
        props.setProperty("mail.pop3.host", "localhost");


        Session session = Session.getInstance(props); 
        final Store store = session.getStore("pop3");  
        store.connect("localhost","xxxx@localhost", "xxx");

错误:

javax.mail.AuthenticationFailedException: Username or password is invalid or incorrect.
at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:213)
at javax.mail.Service.connect(Service.java:366)
at javax.mail.Service.connect(Service.java:246)
at emailclientgamal.EmailClientGamal.referhEmail(EmailClientGamal.java:462)
at emailclientgamal.EmailClientGamal.connect(EmailClientGamal.java:449)
at emailclientgamal.EmailClientGamal.main(EmailClientGamal.java:551)

0 个答案:

没有答案