Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top