00004 BAD UID SEARCH invalid argument

.Net技术 码拜 7年前 (2014-12-24) 2312次浏览 0个评论
{LumiSoft.Net.IMAP.Client.IMAP_ClientException: 00004 BAD UID SEARCH invalid argument
   在 LumiSoft.Net.IMAP.Client.IMAP_Client.Search(Boolean uid, Encoding charset, IMAP_Search_Key criteria)00004 BAD UID SEARCH invalid argument
代码为:Imap.Search(true, Encoding.UTF8, new IMAP_Search_Key_Unseen());
当邮箱为QQ邮箱时,无论IMAP_Search_Key criteria什么值都会引发上述异常。而其他邮箱例如163 都正常。
解决方法为: try charset as null 。即设置Encoding charset参数值为null。
Ivx给出的“

BAD UID SEARCH invalid argument”解决方案为:

First try charset as null

Then try multiple keys at same time.

IMAP_Search_Key_Group sKeys = new IMAP_Search_Key_Group();
sKeys.Keys.Add(new IMAP_Search_Key_Recent());
sKeys.Keys.Add(new IMAP_Search_Key_Deleted());
int[] result = IMAPClient.Search(false, System.Text.Encoding.UTF8, sKeys);

I suspect that your server doesn’t want search key without ().
If so using IMAP_Search_Key_Group will solve this.
But accoring to IMAp rfc it must work otherwise too: https://tools.ietf.org/html/rfc3501#section-6.4.4

原帖文:http://www.lumisoft.ee/Forum/yaf_postst14306_Bug-in-IMAP-Client-Search-Method.aspx

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明00004 BAD UID SEARCH invalid argument
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!