我想询问文件夹是否存在,如果没有创建它。我尝试了下面但是当我在代码中变成下面的粗体行时我得到错误: NO命令收到无效状态。
using (ImapClient ic = new ImapClient(imapAddr, myEmailID, myPasswd, ImapClient.AuthMethods.Login, portNo, secureConn))
{
bool headersOnly = false;
ic.SelectMailbox("INBOX");
Lazy<MailMessage>[] messages = ic.SearchMessages(SearchCondition.Unseen(), headersOnly);
foreach (Lazy<MailMessage> message in messages)
{
MailMessage m = message.Value;
AE.Net.Mail.Imap.Mailbox IsExistFolder = ic.Examine("INBOX/zipi4");
if (IsExistFolder == null)
{
ic.CreateMailbox("INBOX/zipi4");
}
string s = "INBOX/zipi2";
**ic.MoveMessage(m.Uid, s);**
ic.Expunge();
TextWriter writer1 = File.CreateText("Y:\\perl4.txt");
m.Save(writer1);
}
}