2013-08-04 28 views
0

一个新的文件夹如何邮件移动到新的文件夹前景AE.net.Mail,如何将邮件移动到Outlook

我的代码:

using (ImapClient ic = new ImapClient(
          imapAddr, 
          myEmailID, 
          myPasswd, 
          ImapClient.AuthMethods.Login, 
          portNo, 
          secureConn)) 
{ 
    ic.SelectMailbox("INBOX"); 
    bool headersOnly = false; 
    Lazy<MailMessage>[] messages = ic.SearchMessages(SearchCondition.Unseen(), headersOnly); 
    foreach (Lazy<MailMessage> message in messages) 
    { 
     MailMessage m = message.Value; 
    } 
} 

我尝试谷歌,但我不能找到它。 任何建议,非常感谢。

+0

我动议新消息传递给varible type string.now我想将这些消息移动到Outlook中的新文件夹 – zipi

+0

Outlook如何适应AE.net.mail?这不是更多关于规则的Outlook问题吗?也许显示一些代码来澄清? – rene

+0

我试试看:使用(ImapClient ic = new ImapClient(imapAddr,myEmailID,myPasswd,ImapClient.AuthMethods.Login,portNo,secureConn)) ic.SelectMailbox(“INBOX”); bool headersOnly = false; 懒惰 [] messages = ic.SearchMessages(SearchCondition.Unseen(),headersOnly); foreach(消息中的懒惰消息) { MailMessage m = message.Value; – zipi

回答

0

将邮件移动到另一个文件夹做到这一点:

ic.MoveMessage(message.Uid, "some existing folder"); 

uid是MAILMESSAGE的独特identifiier。我假定它映射到message-id,如Internet消息格式的RFC中所述。或者以其他方式与IMAP协议中的UNIQUEID

创建一个新的文件夹,使用此方法:

ic.CreateMailbox("new mailbox name"); 

要发送电子邮件使用SmtpClient,就像是在.NET Framework提供的一个:

 using(SmtpClient client = new SmtpClient("your smtp server.com")) 
     { 
      client.Send("[email protected]", 
         "[email protected]", 
         "subject", 
         "Hello World"); 
     } 
+1

我知道这是一个老问题,但如果有人像我一样有麻烦。您需要在调用MoveMessage之后调用expunge方法。我一直在删除和移动没有成功。删除是我的关键。 –

相关问题