At first I tried fetchmail with the given config. The problem was that all mails in the inbox would be marked as read in IMAP server upon running fetchmail:
set postmaster danial
set no bouncemail
poll mail.tld.com protocol IMAP user "danial" there with password "secret" keep
Next I migrated to getmail6 which didn't mark mails as read on run, but it didn't mark them as read after reading them locally with mail or mutt too; even with --idle=MAILBOX option. Here is the config:
[retriever]
type=SimpleIMAPSSLRetriever
server=mail.tld.com
username=danial
password=secret
[destination]
type=Mboxrd
path=/var/mail/danial
[options]
verbose=0
read_all=false
delivered_to=false
received=false
message_log_syslog=true
message_log_verbose=true
How can I make the read behavior correct?