无法收到来自Apache James的电子邮件 [英] Can't receive emails from Apache James
问题描述
我开发了一个网络邮件来链接apache james,它可以工作.但是某些用户无法收到来自james的电子邮件.我设置mailSession.setDebug(true)
并跟踪两个用户的日志(一个可以接收,另一个不能).区别如下所示:
I developed a webmail to link apache james and it works. But some user cannot receive emails from james. I set mailSession.setDebug(true)
and trace two users' logs(sa can receive, the other cannot). The difference shows below:
可以成功接收电子邮件的用户(用户sa):
the user who can receive email successfully(user sa):
[2012-11-15 14:24:12] com.csc.mail.jsh.mail.core.ReceiveMail : [INFO ] - trying to receive emails from james server...
C: STAT
S: +OK 2 2584
C: NOOP
S: +OK
C: TOP 1 0
S: +OK Message follows
...
其他用户接收失败(用户柴):
the other user receive failure(user chai):
[2012-11-15 14:22:01] com.csc.mail.jsh.mail.core.ReceiveMail : [INFO ] - trying to receive emails from james server...
C: STAT
S: -ERR
C: QUIT
S: +OK Apache James POP3 Server signing off.
[2012-11-15 14:22:03] com.csc.mail.jsh.mail.core.ReceiveMail : [ERROR] - Folder open failed:javax.mail.MessagingException: Open failed;
nested exception is:
java.io.IOException: STAT command failed: null
at com.sun.mail.pop3.POP3Folder.open(POP3Folder.java:228)
at com.csc.mail.jsh.mail.core.ReceiveMail.receive(ReceiveMail.java:82)
at com.csc.mail.jsh.mail.core.ReceiveMail.run(ReceiveMail.java:222)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: STAT command failed: null
at com.sun.mail.pop3.Protocol.stat(Protocol.java:366)
at com.sun.mail.pop3.POP3Folder.open(POP3Folder.java:203)
... 3 more
我的接收代码:
Session mailSession = Session.getInstance(System.getProperties(), null);
mailSession.setDebug(true);
Store store = null;
Folder folder = null; //javax.mail.Folder
try {
store = mailSession.getStore("pop3");
store.connect(Property.getPop3(), userName, password);
logger.info("trying to receive emails from james server...");
folder = store.getFolder("INBOX");
try {
if (!folder.isOpen()) {
folder.open(Folder.READ_WRITE); //the point of throwing the exception
}
} catch (Exception e) {
e.printStackTrace();
}
//receive email from james server.
} catch (Exception e) {
logger.error("Email Receive Error!" + StackTraceStr.st2str(e));
try {
folder.close(true);
} catch (Exception e2) {
}
} finally {
try {
store.close();
} catch (Exception cloex) {
}
}
我已经在此处上发布了帖子.感谢您的帮助!
I had posted a post at here. Thanks for your any help!
推荐答案
我与Apache James接触,终于找到了答案.您可以在这里找到它: STAT命令偶尔会失败一个>.在页面末尾,该线程已被列出.
I had contact with Apache James and finally found the answer. You can find it at here: STAT command failed occasionally. At the end of the page, the thread had been listed.
这篇关于无法收到来自Apache James的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!