Imapsync

From SME Server
Jump to navigation Jump to search

imapsync

imapsync allows you to transfer or synchronize data between any two IMAP servers.

Author: Gilles LAMIRAL <lamiral-at-linux-france.org>

Installation

Enable the dag repository

The following command will configure the dag repository on SME Server. EDIT NOT COMPLETE!


To create an entry in the database for the epel repository we open put the following commands in a terminal window or in a shell window:

/sbin/e-smith/db yum_repositories set epel repository \

Name 'SME Server - epel' \
BaseURL 'http://<http://download.fedoraproject.org/pub/epel/7/$basearch' \
EnableGroups yes \
GPGCheck yes \
Visible no \
status disabled

To enable the changes:

    signal-event yum-modify

Just to be sure, give yum a fresh start:

    yum clean all

After adding it to the database we have to update the changes to the configuration file:

signal-event yum-modify

Install imapsync

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

IMPORTANT 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

Examples

Basic Example

This example would copy all existing folders from foo@imap.truc.org to bar@imap.trac.org

/usr/bin/imapsync \
  --host1 imap.truc.org --user1 foo --passfile1 /etc/secret1 \
  --host2 imap.trac.org --user2 bar --passfile2 /etc/secret2

Bear in mind that you would need to create /etc/secret1 and /etc/secret2 containing the correct passwords for imapuser1 and imapuser2 respectively.

Advanced Example

This example will transfer the public folders 'LearnAsSpam' and 'LearnAsHam' from an Exchange server to the specified user on your SME server:

/usr/bin/imapsync \
-- noauthmd5 \
--host1 a.b.c.d --port1 993 --ssl1 --user1 spamfilter --passfile1 /root/secret1 \
--delete --expunge1 --prefix1 "Public Folders." \
--host2 localhost --port2 993 --ssl2 --user2 spamfilter --passfile2 /root/secret2 \
--folder "Public Folders/LearnAsSpam" \
--folder "Public Folders/LearnAsHam"  \
--noauthmd5