We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

I got error while reading mail from Exchange server

Hi ,
I got following error while reading mail from Exchange server

"Exception in thread “main” ExchangeException: The remote server returned an error: (440) Login Timeout.
—> class com.aspose.email.system.exceptions.WebException: The remote server returned an error: (440) Login Timeout.
com.aspose.email.internal.m.z.b(Unknown Source)
com.aspose.email.internal.m.z.a(Unknown Source)
com.aspose.email.internal.m.bh.a(Unknown Source)
com.aspose.email.internal.m.bi.invoke(Unknown Source)
com.aspose.email.system.d.a(Unknown Source)
com.aspose.email.internal.ck.c.a(Unknown Source)
com.aspose.email.internal.af.m.run(Unknown Source)
java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
java.util.concurrent.FutureTask.run(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
— End of inner exception stack trace —
[Ljava.lang.StackTraceElement;@2bce05fc
at com.aspose.email.ExchangeClient.getMailboxInfo(SourceFile:706)
at com.aspose.email.ExchangeClient.getMailboxInfo(SourceFile:370)
at com.aspose.email.examples.email.FindOSTFiles.main(FindOSTFiles.java:19)
Caused by: class com.aspose.email.system.exceptions.WebException: The remote server returned an error: (440) Login Timeout.
com.aspose.email.internal.m.z.b(Unknown Source)
com.aspose.email.internal.m.z.a(Unknown Source)
com.aspose.email.internal.m.bh.a(Unknown Source)
com.aspose.email.internal.m.bi.invoke(Unknown Source)
com.aspose.email.system.d.a(Unknown Source)
com.aspose.email.internal.ck.c.a(Unknown Source)
com.aspose.email.internal.af.m.run(Unknown Source)
java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
java.util.concurrent.FutureTask.run(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
at com.aspose.email.internal.m.z.b(Unknown Source)
at com.aspose.email.internal.m.z.a(Unknown Source)
at com.aspose.email.internal.m.bh.a(Unknown Source)
at com.aspose.email.internal.m.bi.invoke(Unknown Source)
at com.aspose.email.system.d.a(Unknown Source)
at com.aspose.email.internal.ck.c.a(Unknown Source)
at com.aspose.email.internal.af.m.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
"

I have evaluation version of this API.
I wrote the following code of snippet.

ExchangeClient client = new ExchangeClient(“myOWAClientURL”,“MyUserName”, “MyPassword”, “MyDomain”);

// Call ListMessages method to list messages info from Inbox
ExchangeMessageInfoCollection msgCollection = client.listMessages(client.getMailboxInfo().getInboxUri());

// Loop through the collection to get Message URI
for (ExchangeMessageInfo msgInfo : msgCollection)
{
String strMessageURI = msgInfo.getUniqueUri();

// Now get the message details using FetchMessage()
MailMessage msg = client.fetchMessage(strMessageURI);

// Display message details
System.out.println("Subject: " + msg.getSubject());
[//Console.WriteLine](https://console.writeline/)("HTML Body: " + msg.HtmlBody);

// How many attachments
System.out.println("Number of attachments: " + msg.getAttachments().size());

// List the attachments
for (Attachment att : msg.getAttachments())
{
System.out.println(“Attachment Name: " + att.getName());
}
}

Hi Sandeep,


Thank you for posting your inquiry.

Please use the IEWSClient class to connect to Exchange Server 2010 and above using the Exchange Web Service (EWS). Please try the following code sample at your end and share your feedback with us if you face any issue.

Code:

IEWSClient client = EWSClient.getEWSClient(“Exchange URL”, "Usertwo@ASE1987.onmicrosoft.com", “Aspose1234”, “”);