怎么在c#中利用IMap收取邮件

今天就跟大家聊聊有关怎么在c#中利用IMap收取邮件,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

用法很简单:

public void Test163()
  {
   var imapServer = "imap.163.com";
   var port = 993;
   using (ImapClient client = new ImapClient(imapServer, port, "xxxx@163.com", "pwd", AuthMethod.Login, true))
   {
    // Returns a collection of identifiers of all mails matching the specified search criteria.
    IEnumerable<uint> uids = client.Search(SearchCondition.Unseen());
    // Download mail messages from the default mailbox.
    IEnumerable<MailMessage> messages = client.GetMessages(uids,FetchOptions.HtmlOnly);

    Console.WriteLine("We are connected!");
   }

  }

怎么在c#中利用IMap收取邮件

怎么在c#中利用IMap收取邮件 

然后走Login方法就不会报错了

怎么在c#中利用IMap收取邮件

的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对亿速云的支持。

看完上述内容,你们对怎么在c#中利用IMap收取邮件有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。