IMAP服务器回复了' SEARCH'命令与'BAD'响应

时间:2017-04-15 19:23:47

标签: imap mailkit

我尝试使用MailKit.net库从Gmail中获取特定数量的电子邮件。但执行搜索命令时出错:

  

IMAP服务器回复了' SEARCH'命令与'BAD'响应

这是我的代码:

        var startRange = (page - 1) * pageSize;
        var endRage = page * pageSize;

        var range = new UniqueIdRange(new UniqueId((uint)startRange), 
        new UniqueId((uint)endRage));

        var uIds = Client.Inbox.Search(range, SearchQuery.All).Reverse();

这里是imap.log文件内容:

Connected to imaps://imap.gmail.com:993/
S: * OK Gimap ready for requests from 151.240.143.192 a1mb311709115lfh
C: A00000000 CAPABILITY
S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER AUTH=XOAUTH
S: A00000000 OK Thats all she wrote! a1mb311709115lfh
C: A00000001 AUTHENTICATE PLAIN AHNhZS5oZW1tYXRpQGdtYWlsLmNvbSAAMDg2ODQxMTkxOTA4NjMx
S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS LITERAL- SPECIAL-USE APPENDLIMIT=35651584
S: A00000001 OK sae.hemmati@gmail.com authenticated (Success)
C: A00000002 NAMESPACE
S: * NAMESPACE (("" "/")) NIL NIL
S: A00000002 OK Success
C: A00000003 LIST "" "INBOX"
S: * LIST (\HasNoChildren) "/" "INBOX"
S: A00000003 OK Success
C: A00000004 LIST (SPECIAL-USE) "" "*"
S: * LIST (\All \HasNoChildren) "/" "[Gmail]/All Mail"
S: * LIST (\Drafts \HasNoChildren) "/" "[Gmail]/Drafts"
S: * LIST (\HasNoChildren \Sent) "/" "[Gmail]/Sent Mail"
S: * LIST (\HasNoChildren \Junk) "/" "[Gmail]/Spam"
S: * LIST (\Flagged \HasNoChildren) "/" "[Gmail]/Starred"
S: * LIST (\HasNoChildren \Trash) "/" "[Gmail]/Trash"
S: A00000004 OK Success
C: A00000005 LIST "" "[Gmail]"
S: * LIST (\HasChildren \Noselect) "/" "[Gmail]"
S: A00000005 OK Success
C: A00000006 EXAMINE INBOX (CONDSTORE)
S: * FLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotPhishing $Phishing)
S: * OK [PERMANENTFLAGS ()] Flags permitted.
S: * OK [UIDVALIDITY 611076938] UIDs valid.
S: * 16612 EXISTS

S: * 0 RECENT
S: * OK [UIDNEXT 16834] Predicted next UID.
S: * OK [HIGHESTMODSEQ 1442114]
S: A00000006 OK [READ-ONLY] INBOX selected. (Success)
C: A00000007 UID SEARCH RETURN () UID 0:10
S: A00000007 BAD Could not parse command

任何线索? 提前谢谢!

0 个答案:

没有答案