loop each unread email not working as expected

  • 6 March 2023
  • 7 replies

Badge +4

We have included in our code the Loop each unread email command with the message format set to HTML.

This worked as expected until 2 days ago then it started giving us the below error as soon as the email does not contain content or had a preview available.

Error message -It maybe due to the following reasons :

                1. Your Internet Connection is low.

                2. A Temporary Internal Exchange Server Error occurred.

                3. Connection Reset


We are running the latest loop and email packages. We are connecting to office 365 via EWS, exchange server 2013, and using OAuth2-ROPC.

Has anybody experienced this before and is there a potential solution?

Please assist.

7 replies

Userlevel 7
Badge +13

Hi @Mauritz.Y ,


How are you looping the Unread mails? Is it directly from the INBOX?

If so, consider using a Sub Folder and create a custom rule to move the required mails to this folder soon after they arrive. Perform the looping within this Folder only. Later you can either move these back to INBOX or Archive them according to your convenience.

From my personal experience. looping INBOX may sometime cause issues like long delay in execution or intermittent failure in execution. Because in my case, no matter what condition I put for looping, BOT was keep iterating through all the available Mails within INBOX.

Badge +4

Thank you for the feedback.

We are running the loop in a subfolder of the inbox, and also experienced issues when we ran it against the inbox itself.

Badge +2

@Mauritz.Y Hi, I’m curious if you were able to find a solution to the issue?

I’ve got an automation that’s been running fine for weeks and suddenly with no changes I’m getting this same error on our Email Loop of Unread


Appreciate any feedback or things you tried!

Userlevel 6
Badge +15

Above error is occurred randomly because of the Exchange Server Sync. This issue is resolve by automatically or please restart the server machine will helps to resolve the issue.

Badge +2

UPDATE: For all who end up here with the same error message as above, in case it ends up being helpful my particular situation was caused due to unicode characters/symbols being used in specific email parts (subject/body).

I do not have a permanent solution, but have been able to give my internal teams this info so they can use a temporary solution by removing/deleting these emails to allow automation’s to continue to run.

Finally, I intend on submitting this to AA Support as a potential bug they can document and hopefully determine a permanent solution.

Badge +4

@Frankie A 


We have had a discussion with the AA Support guys around this issue. Keeping in mind we approached it with our issue only.

The main answer that came out of the various discussions with them is that it is the email token that expires before our interactions with Outlook was complete. They did assure us that it was fixed with the version 29 update that was deployed. We have however not had time to test this, but seeing as you are asking I am assuming it was not fixed.

So bottom line from our side is we had to drastically decrease our emails that form part of a loop iteration to ensure the token remains active. There is also no way from the end user side (A360) to reactivate the token for Outlook via AA which would be a no-brainer via a normal API call. We also don't have the luxury of restarting the server every time to avoid the issue our process runs 24/7.

Hope this helps you, but we are currently still in this boat and we have started to explore other alternatives to read our emails and move away from the AA interaction on this part of the process.



"We are also experiencing a similar issue. We are using version 25 of Automation Anywhere 360. While we frequently remove emails from both the inbox and outbox, we have noticed that the reconnection process is taking an excessively long time, approximately one hour. Do you have any alternative methods to resolve this incident? Thank you in advance."