2015-04-21 145 views
0

我发现我无法使用AE.Net.Mail连接到outlook.office365.com的IMAP服务器。该代码非常简单:AE.Net.Mail无法连接到outlook.office365.com IMAP

this._imapClient = new ImapClient(imapServer, username, password, AE.Net.Mail.AuthMethods.Login, port, enableSSL) 

我发现我可以没有问题连接到Gmail,但office365前景将无法连接,我不断收到超时。我已通过将其置入Outlook和Thunderbird来验证IMAP设置。

还有其他人有没有连接AE.Net.Mail到Office365的IMAP服务器?

+0

签出这个前面的stackoverflow发布http://stackoverflow.com/questions/670183/accessing-imap-in-c-sharp – MethodMan

+0

这并没有真正回答他的问题。 – jstedfast

+0

发布了一个答案...能够通过增加超时解决此问题 – gnychis

回答

0

发现我能够通过增加超时连接:

_imapClient.ServerTimeout = 120000; 
    _imapClient.IdleTimeout = 120000; 
    _imapClient.Connect(_imapServer, _port, _enableSSL, false); 
    _imapClient.Login(_username, _password); 
    _imapClient.SelectMailbox("Inbox"); 
2

AE.Net.Mail是相当马车并没有看到任何发展,比去年一年我检查。我会建议使用MailKit

我只是证实MailKit可与Office365.com用下面的代码片段:

using (var client = new ImapClient()) { 
    client.Connect ("outlook.office365.com", 993, true); 
    client.Authenticate ("username", "password"); 

    // get the unread messages 
    var uids = client.Inbox.Search (SearchQuery.NotSeen); 
    foreach (var uid in uids) { 
     var message = client.Inbox.GetMessage (uid); 
    } 

    client.Disconnect (true); 
} 

希望有所帮助。

+0

感谢您的回答。也无法使用ae.net.mail获取新的未读Gmail邮件...所以我会尝试MailKit – gnychis

+0

如果您有任何问题,可以将问题添加到https://github.com/jstedfast/MailKit/issues或你可以在我的github页面上找到我的电子邮件地址。 – jstedfast

+0

哪里可能是一个很好的例子,显示如何只读取未读消息作为列表? – gnychis