Connecting to a mailbox on www.outlook.com

Is it possible, and if so, how would I go about connecting to an email account on Outlook.com?

Hi Ralph,


Thanks for writing to Aspose.Email support team.

Aspose.Email supports connecting to email account at www.outlook.com. You may please visit this link to get the settings for Outllok account.

Following is the sample code which connects to the Outlook.com and retrieves the emails in INBOX. Please give it a try and let us know your feedback.

static public void DisplayMessageFromInbox()
{
Aspose.Email.Imap.ImapClient imapClient = new Aspose.Email.Imap.ImapClient(“imap-mail.outlook.com”, 993, “username@outlook.com”, “password”, CheckCertificate);
imapClient.SecurityMode = ImapSslSecurityMode.Implicit;
imapClient.EnableSsl = true;
imapClient.Connect();
imapClient.SelectFolder(“Inbox”);
ImapMessageInfoCollection messages = imapClient.ListMessages(5);
Console.WriteLine(“Imap: " + messages.Count + " message(s) found.”);
foreach (ImapMessageInfo info in messages)
{
MailMessage mail = imapClient.FetchMessage(info.UniqueId);
Console.WriteLine("Subject = " + mail.Subject);
Console.WriteLine("Sequence No = " + info.SequenceNumber);
}
imapClient.Disconnect();
}
public static bool CheckCertificate(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}

Sadly I missed a piece of information. Is there any way to do this through EWS. There have been some people with security concerns when using Imap.

Hi Ralph,


Outlook.com is just replacement of Hotmail.com and it doesn’t support EWS as also shared over this link. For secure link to your server, you can set the SSL flag to true for encrypted communication as mentioned in the code snippet shared earlier. Please let us know if we can be of any additional help to you in this regard.