0

We have a script that checks a Gmail inbox for new messages, processes any it finds based on the subject and sender, marks said messages read, and then after processing moves the messages to a folder called "ProcessedMessages". This script has been running for several years without incident.

We recently migrated to Azure, and this script began failing on the last command:

 <cfimap action="movemail" 
                connection="myConnection"
                MessageNumber="#x#"
                newfolder="ProcessedMessages">

This line started generating this error every night:

 The cause of this exception was: java.lang.IllegalStateException: This operation is not allowed on a closed folder.

I'm not sure what a closed folder is, but we have tried:

  • Closing any Gmail browser window on any computer logged in as this account.
  • Running the process manually by hitting the url to make sure the task scheduler wasn't the problem.
  • Running the process from a browser window on the server itself pointing to it's own IP to make sure the new CF cluster wasn't causing the problem.
  • Looking around Gmail for some sort of 'closed' flag associated with a folder
  • Moving the messages from the inbox to that folder via the Gmail web interface to make sure there wasn't an account problem (it worked fine)

No changes were made to this Gmail account since the switchover to Azure; in fact no one had even logged into it for at least a month before. The username and password are set correctly on the new Azure server, as evidenced by the fact the script can log in and read message and mark them read.

What does this error message mean and what could cause it?

Nicholas
  • 1,974
  • 4
  • 20
  • 46

1 Answers1

0

This is what I found (same issue):

"A common cause of this kind of issues is that the folder is being modified concurrently using the same account and credentials thus leaving the operations in an inconsistent state." from here:

https://help.mulesoft.com/s/article/Intermittent-IMAP-S-error-This-operation-is-not-allowed-on-a-closed-folder

In my case, it's running every 15 seconds, on 3 different email folders, so it would make sense.

I hope this clarifies the reasons for the issue.