Paul thx for your time and help!

After a long time of testing i noticed something... probably a small thing for a dovecot expert...
The seen mails of the old server have a ",S" at the end of the filename. The seen mails of the new server have a ",:2,S". If I rename the mails before the import, they are also shown as seen after the import. 

Old:
Maildir/cur/1686401814.M960194P17178.post,S=7095,W=7251%3A2,S

New:
Maildir/cur/1686401814.M960194P17178.post,S=7095,W=7251%3A2,:2,S

Is it possible to set an option at the old server, that new mails are marked with ",:2,S" or at the new one. Or would a update of the old server to a newer version help? The current version of the old server is "2.3.4.1"

Best regards
Thorsten

On Fri, Jun 9, 2023 at 1:31 PM Paul Kudla (SCOM.CA Internet Services Inc.) <paul@scom.ca> wrote:

ok i went through this and the best solution although it is a bit of work

is imapsync


imapsync --host1  --user1 --password1 \

--host2 --user2 --password2 \

--regextrans2 "s,\.,_,g"

see : https://github.com/imapsync/imapsync

note the reg parameter above deal with dot in mailboxes etc

virtual mail requires a database of user data, i made a python script to
step through all the account to sync to the new servers.


It basically deals with the compatibility issues between servers.




Happy Friday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email paul@scom.ca

On 2023-06-09 6:51 a.m., t Seeger wrote:
> Thank you for the link, unfortunately I am missing the crucial clue. I
> get the directories backed up, but I don't get them imported
> properly.... all mails are displayed as unseen. i tried with simple
> pasting and the doveadm import command. Is there a trick to preserve the
> flags? Maybe it is because the old dovecot server uses short username
> without the @ and the domain name and the new one uses the mail address
> to identify the user.
>
> On Thu, Jun 8, 2023 at 3:26 PM aki.tuomi via dovecot
> <dovecot@dovecot.org <mailto:dovecot@dovecot.org>> wrote:
>
>     Please see https://doc.dovecot.org/admin_manual/migrating_mailboxes/
>     <https://doc.dovecot.org/admin_manual/migrating_mailboxes/>
>
>     Aki
>
>     -------- Original message --------
>     From: tseegerkrb@gmail.com <mailto:tseegerkrb@gmail.com>
>     Date: 6/8/23 16:10 (GMT+02:00)
>     To: dovecot@dovecot.org <mailto:dovecot@dovecot.org>
>     Subject: Migration dovecot server with local users to dovecot with
>     virtual mailboxes
>
>     Hello,
>     we are using a dovecot server with NIS, we want to transfer it to a
>     new setup. As backend a mysql server will be used in the future.
>     My problem is, if I just copy the maildir or use "doveadm import"
>     all mails are flagged as "unseen". How can i preserve the flags?
>
>     This is how I have tried it so far.
>     root@mail / $ doveadm import -s -u testuser@testdomain.local
>     maildir:/tmp/testuser-maildir-230608/Maildir/:INDEX=MEMORY "" "All"
>
>     As a "workaround" I tried to change the flags.
>     root@mail / $ doveadm -v flags add -u testuser@testdomain.local
>     "Seen" "ALL"
>     This led partially to the desired success, the mails are shown as
>     "seen", but the folders (e.g. Roundcube) still show unread mails.
>
>     dovecot -n
>     ############################################
>     # 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
>     # Pigeonhole version 0.5.13 (cdd19fe3)
>     # OS: Linux 5.10.0-23-cloud-amd64 x86_64 Debian 11.7
>     # Hostname: mail.testdomain.local
>     auth_mechanisms = plain login
>     mail_fsync = always
>     mail_gid = vmail
>     mail_home = /var/vmail/mailboxes/%d/%n
>     mail_location = maildir:~/mail:LAYOUT=fs:INDEX=MEMORY
>     mail_privileged_group = vmail
>     mail_uid = vmail
>     managesieve_notify_capability = mailto
>     managesieve_sieve_capability = fileinto reject envelope
>     encoded-character vacation subaddress comparator-i;ascii-numeric
>     relational regex imap4flags copy include variables body enotify
>     environment mailbox date index ihave duplicate mime foreverypart
>     extracttext imapsieve vnd.dovecot.imapsieve
>     mmap_disable = yes
>     namespace inbox {
>        inbox = yes
>        location =
>        mailbox Drafts {
>          auto = subscribe
>          special_use = \Drafts
>        }
>        mailbox Sent {
>          auto = subscribe
>          special_use = \Sent
>        }
>        mailbox Spam {
>          auto = subscribe
>          special_use = \Junk
>        }
>        mailbox Trash {
>          auto = subscribe
>          special_use = \Trash
>        }
>        prefix =
>     }
>     passdb {
>        args = /etc/dovecot/dovecot-sql.conf
>        driver = sql
>     }
>     plugin {
>        imapsieve_mailbox1_before =
>     file:/var/vmail/sieve/global/learn-spam.sieve
>        imapsieve_mailbox1_causes = COPY
>        imapsieve_mailbox1_name = Spam
>        imapsieve_mailbox2_before =
>     file:/var/vmail/sieve/global/learn-ham.sieve
>        imapsieve_mailbox2_causes = COPY
>        imapsieve_mailbox2_from = Spam
>        imapsieve_mailbox2_name = *
>        quota = maildir:User quota
>        quota_exceeded_message = User %u has exhausted allowed storage space.
>        sieve =
>     file:/var/vmail/sieve/%d/%n/scripts;active=/var/vmail/sieve/%d/%n/active-script.sieve
>        sieve_before = /var/vmail/sieve/global/spam-global.sieve
>        sieve_global_extensions = +vnd.dovecot.pipe
>        sieve_pipe_bin_dir = /usr/bin
>        sieve_plugins = sieve_imapsieve sieve_extprograms
>     }
>     protocols = imap lmtp sieve
>     service auth {
>        unix_listener /var/spool/postfix/private/auth {
>          group = postfix
>          mode = 0660
>          user = postfix
>        }
>        unix_listener auth-userdb {
>          group = vmail
>          mode = 0660
>          user = vmail
>        }
>     }
>     service imap-login {
>        inet_listener imap {
>          port = 143
>        }
>        process_min_avail = 1
>        service_count = 1
>     }
>     service lmtp {
>        unix_listener /var/spool/postfix/private/dovecot-lmtp {
>          group = postfix
>          mode = 0660
>          user = postfix
>        }
>        user = vmail
>     }
>     service managesieve-login {
>        inet_listener sieve {
>          port = 4190
>        }
>     }
>     ssl = required
>     ssl_ca = </etc/dovecot/private/ca-testdomain.local_tls_srv_crt.crt
>     ssl_cert = </etc/dovecot/private/mail.testdomain.local_tls_srv_crt.crt
>     ssl_cipher_list =
>     ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
>     ssl_dh = # hidden, use -P to show it
>     ssl_key = # hidden, use -P to show it
>     ssl_min_protocol = TLSv1.2
>     userdb {
>        args = /etc/dovecot/dovecot-sql.conf
>        driver = sql
>     }
>     protocol imap {
>        imap_idle_notify_interval = 29 mins
>        mail_max_userip_connections = 20
>        mail_plugins = " quota imap_quota imap_sieve"
>     }
>     protocol lmtp {
>        mail_plugins = " sieve notify push_notification quota"
>        postmaster_address = postmaster@testdomain.local
>     }
>     ############################################
>
>     Thanks for your help
>     _______________________________________________
>     dovecot mailing list -- dovecot@dovecot.org <mailto:dovecot@dovecot.org>
>     To unsubscribe send an email to dovecot-leave@dovecot.org
>     <mailto:dovecot-leave@dovecot.org>
>     _______________________________________________
>     dovecot mailing list -- dovecot@dovecot.org <mailto:dovecot@dovecot.org>
>     To unsubscribe send an email to dovecot-leave@dovecot.org
>     <mailto:dovecot-leave@dovecot.org>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
>
> _______________________________________________
> dovecot mailing list -- dovecot@dovecot.org
> To unsubscribe send an email to dovecot-leave@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-leave@dovecot.org