I switched one of my servers to Dovecot this morning. Everything went fine, except it would have been nice to know in advance about a very important side effet of the switch:
All emails still in the server's mbox files are RESENT to POP3 users after the upgrade!
Some email users had their Outlook (wrongly) configured with the "Leave a copy of messages on the server" checked on (I assume). One of them had over 45,000 messages still sitting on my server!
Once Dovecot started after the upgrade, the users who had their Outlook left active got ALL MESSAGES downloaded again, causing tons of duplicates in their local inbox. This could (and should) have been avoided.
Don't worry, I'm not posting only to complain about this unexpected behavior. Please read on...
For those who didn't leave their outlook open during the weekend, it was still time to move all the converted messages to a subdirectory of their INBOX, so that it's available from squirrelmail, but not downloaded again once they come in to work on Monday:
I hope the code above will help other DA users avoid the problem. You have to run it before enabling Dovecot after the conversion (maybe someone can help avoid the Dovecot service restart right after the conversion in "./build todovecot"?
The above problem affects only POP3 users. For IMAP users, the conversion occurs with no side effect, and running the script above does no harm since it simply creates a new INBOX sub-folder where they can get their old messages.
Hope this helps.
All emails still in the server's mbox files are RESENT to POP3 users after the upgrade!
Some email users had their Outlook (wrongly) configured with the "Leave a copy of messages on the server" checked on (I assume). One of them had over 45,000 messages still sitting on my server!
Once Dovecot started after the upgrade, the users who had their Outlook left active got ALL MESSAGES downloaded again, causing tons of duplicates in their local inbox. This could (and should) have been avoided.
Don't worry, I'm not posting only to complain about this unexpected behavior. Please read on...
For those who didn't leave their outlook open during the weekend, it was still time to move all the converted messages to a subdirectory of their INBOX, so that it's available from squirrelmail, but not downloaded again once they come in to work on Monday:
Code:
cd /home
for a in *
do
cd /home/$a
for i in imap/*/*/Maildir
do
cd /home/$a/$i
# Only move converted emails if none was downloaded from Dovecot yet
if test ! -f dovecot-uidlist -a -d new
then
mkdir .INBOX.Converted
chown $a:mail .INBOX.Converted
chmod 770 .INBOX.Converted
echo INBOX.Converted >> subscriptions
chown $a:mail subscriptions
chmod 660 subscriptions
cd .INBOX.Converted
mkdir cur new tmp
chown $a:mail cur new tmp
cd ../new
# Using "find" instead of "mv" to avoid "args list too long" error
find . -name '*.mbox' -print | cpio -pumdvl ../.INBOX.Converted/cur
find . -name '*.mbox' -links 2 -print | xargs rm -f
cd ..
ls -l `pwd`/.INBOX.Converted
fi
done
done
I hope the code above will help other DA users avoid the problem. You have to run it before enabling Dovecot after the conversion (maybe someone can help avoid the Dovecot service restart right after the conversion in "./build todovecot"?
The above problem affects only POP3 users. For IMAP users, the conversion occurs with no side effect, and running the script above does no harm since it simply creates a new INBOX sub-folder where they can get their old messages.
Hope this helps.