I spent entirely too much time in the last few days setting up to imapsync between two Zimbra environments. I will spare you the whole story but suffice to say we moved some users from production to a newly upgraded development environment and then managed to wipe out a significant portion of their mail. They were already receiving mail in the dev environment so re-copying the mail from prod wasn’t an option. Zimbra’s backup and restore isn’t smart enough to restore from one address (@prod.com->@dev.com). The obvious solution is to imapsync from prod to dev. Simple, right?
It turns out Zimbra adds headers when messages are added to the destination side. This means if you run imapsync more than once, say, to test on a folder and then run it for a whole account it will re-upload messages it just uploaded as the new headers on the destination side made the messages different. The solution is to –skipsize and ‘useheader’ enough headers so you’re sure they’ll make messages unique even if all headers aren’t in all messages (Message-ID is not in all messages for instance) but they won’t be changed on the destination side. I used –useheader Message-ID –useheader ‘From’ –useheader ‘To’ –useheader ‘Date’
imapsync --sep1 '/' --prefix1 '' --authmech1 PLAIN --ssl1 \ --host1 imap.prod.com --user1 user --password1 pass \ --authmech2 PLAIN -ssl2 --host2 imap.dev.com --user2 user2 \ --password2 pass2 --useheader Message-ID --useheader 'From' \ --useheader 'To' --useheader 'Date' --skipsize
We also saw problems with messages presumably larger than 10mb:
++++ From [Sent] Parse 1 ++++ ++++ To [Sent] Parse 1 ++++ ++++ Verifying [Sent] -> [Sent] ++++ + NO msg #286039 [VsZ9lgHjrPxeOAn7S9sU6Q] in Sent + Copying msg #286039:12572025 to folder Sent flags from : [\Seen]["04-May-2009 07:46:14 -0400"] parse_headers want an ARRAY ref Couldn't append msg #286039 (Subject:) to folder Sent: Error trying to append: 6568 NO [TOOBIG] request too long
A look in the user’s sent folder for a message at 07:46 showed a 12mb message. Search the zimbra forums and:
[zimbra@store01 ~]$ zmprov gacf|grep -i zimbraMtaMaxMessageSize zimbraMtaMaxMessageSize: 10485760 [zimbra@store01 ~]$ zmprov mcf zimbraMtaMaxMessageSize 50000000 [zimbra@store01 ~]$
You can now re-run imapsync as above and the message will be copied.
Also of note is –sep1 ‘/’ and –prefix ”: Apparently the Zimbra 5.0.7 imap server does not have NAMESPACE capability.
edit 090706: changed zimbraFileUploadMaxSize to zimbraMtaMaxMessageSize. According to http://wiki.zimbra.com/index.php?title=Guide_to_imapsync this was changed in 5.0.6.