1

我在巴西主机 (uol.com.br) 的服务器上有一个邮件帐户。此帐户用于测试,收件箱中有 7.000 条消息。当我通过 java 邮件和 setDebug(true) 连接时,消息不会返回并显示此消息:

03-22 14:44:07.305: I/System.out(5524): A1 OK User logged in
03-22 14:44:07.320: I/System.out(5524): A2 CAPABILITY
03-22 14:44:07.435: I/System.out(5524): * CAPABILITY IMAP4 IMAP4rev1 QUOTA UIDPLUS NO_ATOMIC_RENAME UNSELECT CHILDREN MULTIAPPEND BINARY SORT
03-22 14:44:07.435: I/System.out(5524): A2 OK Completed
03-22 14:44:07.500: I/System.out(5524): A3 LIST "" "%"
03-22 14:44:07.835: I/System.out(5524): * LIST (\HasNoChildren) "." "INBOX"
03-22 14:44:07.850: I/System.out(5524): * LIST (\HasNoChildren) "." "Quarentena"
03-22 14:44:07.870: I/System.out(5524): * LIST (\HasNoChildren) "." "Drafts"
03-22 14:44:07.885: I/System.out(5524): * LIST (\HasNoChildren) "." "Sent Messages"
03-22 14:44:07.925: I/System.out(5524): * LIST (\HasNoChildren) "." "Deleted Messages"
03-22 14:44:07.950: I/System.out(5524): A3 OK Completed (0.000 secs 6 calls)
03-22 14:44:07.990: I/System.out(5524): DEBUG: connection available -- size: 1
03-22 14:44:07.995: I/System.out(5524): A4 SELECT INBOX
03-22 14:44:08.130: I/System.out(5524): * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
03-22 14:44:08.145: I/System.out(5524): * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)]  
03-22 14:44:08.160: I/System.out(5524): * 7245 EXISTS
03-22 14:44:08.170: I/System.out(5524): * 1 RECENT
03-22 14:44:08.180: I/System.out(5524): * OK [UNSEEN 7243]  
03-22 14:44:08.190: I/System.out(5524): * OK [UIDVALIDITY 1208433603]  
03-22 14:44:08.235: I/System.out(5524): * OK [UIDNEXT 10125]  
03-22 14:44:08.235: I/System.out(5524): A4 OK [READ-WRITE] Completed
03-22 14:44:21.555: I/System.out(5524): A5 SEARCH UNSEEN ALL
03-22 14:44:23.910: I/System.out(5524): A5 BAD Unsupported command.

这是设置标志的代码的一部分。在 gmail 中,此代码适用于收件箱文件夹中的 100 条消息

public Message[] getInboxMessages() {
        Message[] messages = null;
        try {

            Flags f1 = new Flags(Flags.Flag.SEEN);
            FlagTerm notseen = new FlagTerm(f1, false);

            messages = mInboxFolder.search(notseen);            

        } catch (NoSuchProviderException e) {
            Log.w(TAG, e.getMessage());

        } catch (MessagingException e) {
            Log.w(TAG, e.getMessage());
        }
        return messages;
    }
4

1 回答 1

3

服务器坏了。它似乎没有正确支持 IMAP 协议。向服务器供应商报告错误。

如果您需要解决服务器错误,则需要避免使用该“搜索”命令。您可以获取所有消息,而只需跳过标记为 SEEN 的消息。

于 2013-03-22T22:27:21.920 回答