获取邮箱列表c#ae.net.mail

时间:2013-08-05 10:26:12

标签: c#-4.0

我想获取INBOX下的文件夹列表。我尝试以下内容:但我不知道我需要发送的内容在哪里?

bool headersOnly = false;
ic.SelectMailbox("INBOX");
Lazy<MailMessage>[] messages = ic.SearchMessages(SearchCondition.Unseen(), headersOnly);
foreach (Lazy<MailMessage> message in messages)
{
   AE.Net.Mail.Imap.Mailbox[] m2 = ic.ListMailboxes**("??","??");**
}

1 个答案:

答案 0 :(得分:2)

我已使用以下代码从我的Gmail帐户中获取所有电子邮件,但工作正常。

AE.Net.Mail.ImapClient client = new AE.Net.Mail.ImapClient(emailHost, emailAddress, emailPassword, AE.Net.Mail.AuthMethods.Login, port, useSsl);
AE.Net.Mail.Imap.Mailbox[] mailBoxes = client.ListMailboxes(string.Empty, "*");
foreach (var mailBox in mailBoxes)
{
    var mailboxName = mailBox.Name;
}