Free Support Forum - aspose.com

Error Connecting to Exchange

We just purchased Aspose.Email and are having troubles getting started. Do you have any articles on trouble-shooting connection issues? I am trying to connect and send emails via the ExchangeClient but no matter what I enter for credentials we get either "Forbidden" or "Login Timeout" errors. I'm not really sure where to start digging. We are connecting to Exchange 2010.

Thank you,

Heather

Hi Heather,


Thank you for using Aspose.Email.

I would like to share with you that ExchangeClient class is used to access Exchange Server 2003 and 2007 over WebDav protocol. In order to connect to Exchange Server 2010, you need to use the ExchangeWebServiceClient (EWS) class as follow:

// Create instance of
ExchangeWebServiceClient class by giving credentials
ExchangeWebServiceClient client = new
ExchangeWebServiceClient(“https://exchange-server-host/ews/Exchange.asmx”, “user”, “pwd”, “domain”);

// Get mailbox size
Console.WriteLine("Mailbox size: " + client.GetMailboxSize() + " bytes");

// Get exchange mailbox info
ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();

// Get Mailbox URI
Console.WriteLine("Mailbox URI: " + mailboxInfo.MailboxUri);

// Get Inbox folder URI
Console.WriteLine("Inbox folder URI: " + mailboxInfo.InboxUri);

// Get Sent Items folder URI
Console.WriteLine("Sent Items URI: " + mailboxInfo.SentItemsUri);

// Get Drafts folder URI
Console.WriteLine("Drafts folder URI: " + mailboxInfo.DraftsUri);

For further examples, please refer to the Programming with Exchange section of our online documentation. These examples contain code snippets for both ExchangeClient (Exchange 2003 and 2007 using webdav) and ExchangeWebServiceClient (Exchange 2007 and 2010). You should consider the examples of EWS for your needs. Please let us know if we can be of any additional help to you. We will try to help you as soon as possible.