Imapsync v1.2.7 and WebTop v1.5.7

NethServer Version: 8 (latest)
Module: Imapsync and webtop

Hi all, I have an issue with my mails:

When I mark an email as read in WebTop, it is shown as unread again after some time, presumably when the emails are fetched from the provider again.

Do you know this problem?

1 Like

not aware of that, I did a migration recently and imapsync is still syncing as far as I know the sync is still done each hour without the issue you are describing

there is a flag --noresyncflags that should prevent it

1 Like

you need to be more talkative

give use the full parameters of the sync you can find them in the env of the tasks

explain us if the messages are modified on the two sides

sorry, I need more time…

pls show me that in detail…

runagent -m imapsync1
cat imapsync/*.env

set generic user and domain for security

1 Like
imapsync1@apps:~/.config/state$ cat imapsync/*.env

TASK_ID=cb31ju
LOCALUSER=user1
REMOTEUSERNAME=user1@domain1.at
REMOTEHOSTNAME=bimap.A1.net
REMOTEPORT=993
SECURITY=--ssl1
DELETE_LOCAL=
DELETEFOLDER=
EXCLUDE=
DELETE_REMOTE=--delete1older=90
SIEVE_ENABLED=
EXPUNGE_REMOTE=--noexpungeaftereach
CRON=3m
FOLDER_INBOX=
FOLDERSYNCHRONIZATION=all

TASK_ID=7m96oo
LOCALUSER=user2
REMOTEUSERNAME=user2@domain2.at
REMOTEHOSTNAME=is.bitego.com
REMOTEPORT=993
SECURITY=--ssl1
DELETE_LOCAL=
DELETEFOLDER=
EXCLUDE=
DELETE_REMOTE=
SIEVE_ENABLED=
EXPUNGE_REMOTE=
CRON=3m
FOLDER_INBOX=
FOLDERSYNCHRONIZATION=all

The issue came after the migration to debian 13 ?

do you read the mail from the remote source ?

I looked into this issue with the imapsync flags behavior.

By default, imapsync resyncs all flags (including \Seen) on every run, even for messages that were already transferred before. This is documented behavior, not a bug in imapsync itself.

In the syncctl script used by ns8-imapsync, --noresyncflags is only applied when FOLDER_INBOX is set. In the reported ticket, FOLDER_INBOX is empty in both .env files. So --noresyncflags is never used here.

The cron for these two tasks runs every 3 minutes. If the user only reads mail through WebTop, and never logs into the source mailbox directly, the source side stays \Unseen forever. Every 3 minutes, imapsync pulls the flags from the source again and overwrites the \Seen flag set in WebTop. That’s why messages keep going back to unread.

First thing to try

Could you enable FOLDER_INBOX (only inbox) on this task and see if it fixes the behavior? This turns on --search1=UNSEEN --setflag1=Seen --noresyncflags, which matches this use case well: only new unseen messages get synced, they get marked Seen on the source, and flags are never touched again after that.

Also, one question @fausp : since when does this happen? Did it start right after setup, or after a certain period of use? That would help confirm whether this is really about the source mailbox never being touched, or something else changed recently.

Second point, about a possible PR

--noresyncflags and FOLDER_INBOX are currently tied together in the code, but they solve two different problems. Some setups may want FOLDER_INBOX filtering without --noresyncflags, or the other way around, like this ticket.

Before writing a PR, I think we need to answer one question: should --noresyncflags be applied all the time by default, or only for tasks that run on a short, repeated cron schedule (like every 3 minutes)? A one-time or occasional sync probably still benefits from flag resync, since flags might genuinely change on the source between runs. But a very frequent cron on a source that nobody reads directly is exactly the case where flags should stop being resynced after the first transfer.

Happy to open an issue or draft a PR once we agree on that behavior.

2 Likes

No, this is another Server, this one si still runing on deb12…

It looks good, pse give me a few days more to get feedback also from the customer…

1 Like

I can reproduce your bug on my server, cc @davidep

valid bug report thank @fausp

1 Like