【问题标题】:S22 imap fetch mails from office365S22 imap 从 office365 获取邮件
【发布时间】:2017-06-02 20:28:31
【问题描述】:

我正在使用 s22.Imap 引用从服务器获取新邮件。在读取交换服务器时,一切都很完美。但是我们被转移到了office365。现在我无法从我的项目中读取新邮件。这是小代码。

using (ImapClient client = new ImapClient("outlook.office365.com", 993, user, pass, AuthMethod.Login, true)) {

   // Returns a collection of identifiers of all mails matching the specified search criteria.
   IEnumerable<uint> uids = client.Search(SearchCondition.New());

   // Download mail messages from the default mailbox.
   IEnumerable<MailMessage> messages = client.GetMessages(uids);

   foreach (MailMessage item in messages) { blablabla }

这部分返回这个错误:The stream could not be read.

最后,我在 Windows 服务应用程序中使用了这些代码。所以我没有明确调试。

有人帮助我吗?

【问题讨论】:

    标签: email ssl office365 imap


    【解决方案1】:

    可能,但我认为该帐户的订阅应该是 在线交换,而不是经典订阅

    我对 S22 库做同样的事情,但我们要求更改邮件的配置以接受 imap 连接

    【讨论】:

      【解决方案2】:

      Office365 不支持AuthMethod.Login。试试AuthMethod.Plain 或尝试使用不同的IMAP 库,比如我的MailKit 库,它维护得更积极。

      希望对您有所帮助。

      【讨论】:

        猜你喜欢
        • 2015-06-03
        • 2021-07-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-17
        • 1970-01-01
        • 1970-01-01
        • 2020-06-22
        相关资源
        最近更新 更多