我正在使用来自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