我尝试使用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)