Hi,
We are using aspose-email-17.3.0-jdk16.jar since long time. We got a new error never happened before:
On ImapClient.SelectFolder(ImapFolderInfo.IN_BOX) we have a timeout exception (Connection failure. Timeout ‘200000’ has been reached).
The program runs every 15 minutes. Can you please help.
Here is my code:
private boolean HandleEmailsAspose(IDfSession session, StoreInDocumentum sDctm, Properties prop,
String user, String password, String emailACL) {
ImapClient client = null;
try
{
client = new ImapClient();
client.setHost(emailHost);
client.setPort(Integer.parseInt(emailPort));
client.setUsername(user);
client.setPassword(password);
client.setSecurityOptions(SecurityOptions.Auto);
client.selectFolder(ImapFolderInfo.IN_BOX);
client.setTimeout(900000); // in ms
ImapMessageInfoCollection coll = client.listMessages();
try
{
for(int pt = 0; pt < 30; pt++)
{
coll = client.listMessages();
if(coll.size() == 0)
break;
ImapMessageInfo info = coll.get_Item(0);
MailMessage eml = null;
try {
eml = client.fetchMessage(info.getUniqueId());
}
catch(ImapException imap) { //EK: 2021-09-29: added to handle move exception
....
break;
}
if(eml != null)
{
-- do processing here --
}
}
return true;
}
catch (Exception e) {
return false;
}
}
catch(Exception e) {
return false;
}
finally {
if(client != null)
client.dispose();
}
}