Check email IMAP: error when moving mails

CMK version: Checkmk Raw Edition 2.2.0p22
OS version: docker (on debian)

Error message: Failed to copy mail: error(“COPY command error: BAD [b’Error in IMAP command COPY: Missing arguments (0.001 + 0.000 secs).']”)

explanation:

i am running checkmk raw in docker. have for almost a year now.
the only thing i do with it, is reading a imap mailbox which receives dozens of backup reports from several synology devices.

in the rule: check email options, i am using this:

“Cleanup messages”-“move to subfolder”-“INBOX.Trash” (reason i don’t just use the “delete” option is because that completely deletes the mail from the inbox instead of moving it to the trashbin)

after a recent checkmk update to latest version, i am getting the above mentioned error.
everything still works, the messages are still forwarded to the event console and the messages are moved to the trash folder in the mailbox… but i get that error

There was recently a werk in regards to a fix to spool folder but I doubt this could cause problems.

Are you sure that /path/to/folder is “INBOX.Trash” ? For example, I used gmail and the path is

–cleanup=[Gmail]/Trash

and this works.

I think this error depends on the imap server. Some servers handle it well if you tell them “move this list of IDs” and then the “list” is empty. Exchange doesn’t always like that.

@chauhan_sudhir I raised this in SUP-17106 a few weeks ago, my suggested fix (that we’re running internally) is included in the ticket.

our workaround, above the try: block in checkmk/cmk/utils/mailbox.py at 2.2.0 · Checkmk/checkmk · GitHub

Check if there are actually any mails to move:
{{if len(mails) > 0: }}

otherwise, don’t do anything :slight_smile:

1 Like

Hello,

chauhan_sudhir

I am using a regular imap server. it’s a VPS with plesk, dovecot, postfix (and roundcube)

it has worked for over a year. i think this error is happening since a checkmk update, but truth be told: it could be because a vps server update too

gstolz

will this be fixed in a future release then?

Yes, we are looking into the ticket.

In the meantime, could you use check_mailboxes with verbose and see if the foldername where you want to move it is really the right one ?

Also, does the fix Gerd work for you ? Can you try this if possible and give some feedback ?

Hi @qwerty and @gstolz,

we just fixed this moving mails bug. As you suggested @gstolz, we now skip the copying command if there are no mails to be copied.

This change will be included in the upcoming 2.2.0p24 and you can find the corresponding werk here: Prevent check_mail crash for "Move to subfolder" option.

Best regards,
Kenneth

1 Like

Unfortunately only in version 2.2.0p25. Werk #16630

You’re right, i’m sorry for the wrong information. Apparently, the change came in a bit too late for the p24.

1 Like