我正在使用來自limilabs的mail.dll的c#應用程序。使用以下代碼我從服務器檢索郵件。ImapResponseException重複文件夾INBOX
try
{
imap.ServerCertificateValidate += new ServerCertificateValidateEventHandler(Validate);
imap.Connect(server);
Console.WriteLine("Imap Connected");
imap.UseBestLogin(username, password);
Console.WriteLine("Imap Logged in");
string[] folders = new string[] { "Verwijderde items", "INBOX"};
foreach (string folder in folders)
{
if (folder.Equals(string.Empty))
break;
foreach (FolderInfo folderInfo in imap.GetFolders())
{
if (folderInfo.Name.Equals(folder))
{
imap.Select(folder); //ImapResponseException
//Process found mail
break;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine("Imap not Connected");
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}
"verwijderde items"
是荷蘭已移除項目或回收站。
ImapResponseException: Duplicate folder INBOX were detected in the mailbox. Therefore the user's connection was disconnected.
此異常拋出,因爲我使用的登錄用戶名和密碼即可訪問收件箱了所有員工。也許我需要使用imap.Select("[email protected]/inbox/ + folder")
來指定我想訪問的用途。但我不知道imap使用的文件結構。也許這不是這個特定的DLL的解決方案。所有想法都歡迎。
我連接到該服務器的Windows Server 2008 R2與Microsoft Exchange 2007
更新1: Mail.dll文檔:http://www.limilabs.com/static/mail/documentation/
Imap.select(folderinfo)確實存在但提供相同的異常。文檔可以在這裏找到:http://www.limilabs.com/static/mail/documentation/ –
看起來像我關於什麼folderInfo.Name代表錯誤的假設。我猜這是基於這些文檔的完整路徑,但我認爲它是郵箱名稱而不是文件夾路徑。我已經更新了我的答案,以展示如果您有興趣,如何使用我自己的IMAP庫做你想做的事情。 – jstedfast