From SME Server
Jump to navigationJump to search

Example Renaming Destination Folder

Imapsync can rename folders as it transfers email. This example transfers 'zLearnAsSpam' and 'zLearnAsHam' from 'Public Folders' on server1 to 'LearnAsSpam' and 'LearnAsSpam' in the root of the destination user's mailbox.

The renaming is accomplished using the 'regextrans2' directive.

Tested with imapsync v1.350

usr/bin/imapsync \
--noauthmd5 --buffersize 8192000 --nosyncacls \
--host1 --port1 993 --ssl1 --user1 username1 --passfile1 /root/secret1 \
--delete --expunge1 --prefix1 "Public Folders." \
--host2 localhost --port2 993 --ssl2 --user2 username2 --passfile2 /root/secret2 \
--folder "Public Folders/zLearnAsSpam" \
--folder "Public Folders/zLearnAsHam"  \
--regextrans2 's/Public.Folders.//' \
--regextrans2 's/zLearn/Learn/' \

Install imapsync on SME9beta2

CentOS6 / SME9 includes one of the imapsync dependencies (perl-Parse-RecDescent) in the 'base' repo. Consequently, it does not exist in the dag repo.

In order to make perl-Parse-RecDescent available to yum, add the 'base' repo to the installation command:

yum --enablerepo=dag,base install imapsync

Older Notes and Comments

==== Install imapsync ====
 yum --enablerepo=dag install perl-Mail-IMAPClient-2.2.9 imapsync

If you install imapsync without specifying perl-Mail-IMAPClient-'''2.2.9''' on the command line as shown above, yum will download and install the latest available version of perl-Mail-IMAPClient - currently 3.x - which does not work according to the author of imapsync.  If this happens, you will get an error about IMAPClient every time you run imapsync.

If you have accidentally installed the wrong version of IMAPClient, you can correct the problem using the command below.  When done, reinstall imapsync as shown above.
 yum remove perl-Mail-IMAPClient

Above warning removed from main page as it no longer seems relevant. Mmccarn 15:59, 24 September 2011 (MDT)

Brilliant piece of kit - worked very well for me to move some older folders from one account into an archive account on the same server:

imapsync --noauthmd5 --host1 localhost --user1 sourceaccount --host2 localhost --user2 destaccount --folderrec "Name Of Folder With Old Emails In" --password1 "xxxxxxxx" --password2 "xxxxxxxx"

Judgej 13:50, 25 June 2010 (UTC)