سؤال

I want to get all the emails from my mailbox in Office 365.

I have this code:

SmtpClient client = new SmtpClient("smtp.outlook.office365.com");
client.Port = 587;
client.EnableSsl = true;
client.UseDefaultCredentials = false;
NetworkCredential cred = new System.Net.NetworkCredential("*********@*******.onmicrosoft.com", "pass");
client.Credentials = cred;

But now I don't have a method to fetch email.

هل كانت مفيدة؟

المحلول

To get all messages from your email account, you must use either POP or IMAP protocols. .NET Framework currently has no native support for POP or IMAP.

You can use an open source library like mailsystem.codeplex.com or a commercial library like www.limilabs.com. Visit their websites to get sample codes. There's a large number of library in .NET.

The following thread deals with free IMAP library for example : https://stackoverflow.com/questions/4212216/good-free-imap-library-for-c-net

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top