Messages copied into a mailbox do not appear
Messages you copy into a mailbox as root do not appear in the mail client. Changing the ownership of the copied files lets Dovecot read them.
Symptoms
After you copy a mailbox from another server or restore it by hand, some messages or entire folders are missing from the mail client. The storage figure from doveadm quota get reads error.
Look for Dovecot errors like these in /var/log/maillog on AlmaLinux or /var/log/mail.log on Ubuntu.
Error: Mailbox INBOX: open(/home/USER/files/mail/example.com/user/cur/1764482402.M3P3.oldserver:2,S) failed: Permission denied (euid=1003(USER) egid=1003(USER) missing +r perm: ...)Error: Mailbox Archive: file_dotlock_create(/home/USER/files/mail/example.com/user/.Archive/dovecot-uidlist) failed: Permission denied (euid=1003(USER) egid=1003(USER) missing +w perm: /home/USER/files/mail/example.com/user/.Archive, dir owned by 0:0 mode=0755)Cause
UrbeStack keeps each mailbox in the customer's home directory. The customer owns the mailbox, and Dovecot reads and writes it as that customer.
Files and folders you copy as root stay owned by root. Dovecot cannot read those files or write to those folders. Messages copied with the customer's ownership appear the next time the mailbox is accessed.
Resolution
Find the mailbox directory.
doveadm user -f home user@example.comSet the owner of the directory and everything in it to the customer. Use the path the previous command printed.
chown -R USER:USER /home/USER/files/mail/example.com/userHave Dovecot read the mailbox again and recalculate its quota usage.
doveadm force-resync -u user@example.com '*' doveadm quota recalc -u user@example.comCheck that the storage figure is a number again.
doveadm quota get -u user@example.com