ImapCopy or fast way to migrate mail between servers
The following guide describes the installation very simple program which is ImapCopy through which we will migrate mail from one server to another.
Let's get started is extremely simple.
Installation ImapCopy
ImapCopy is available in the repository of Debian / ubuntu. Its installation is simple and comes down to one issue the command:
1 | sudo apt-get install imapcopy |
Configuration
Click the configuration can be found in the directory:
1 | /usr/share/doc/imapcopy/examples |
Edit the file named:ImapCopy.cfg
1 | nano /usr/share/doc/imapcopy/examples/ImapCopy.cfg |
Edit the file as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ############################################################# # imapcopy config # all lines beginning with # are comments and will be ignored ############################################################# ############## # Sourceserver ############## SourceServer serwer.nazwa.pl SourcePort 143 ################### # Destinationserver ################### DestServer ip-serwera gdzoe ma zostać przeniesiona poczta. DestPort 143 |
We go to the bottom of the file and configure the box to transfer.
1 2 3 4 5 | ############################# # List of users and passwords ############################# # SourceUser SourcePassword DestinationUser DestinationPassword Copy "pomoc@serwerweb.pl" "hasło_na_starym_serwerze" "pomoc@serwerweb.pl" "hasło_na_nowym_serwerze" |
In order to test if everything is well configured to run the program in the directory where imapcopy signed our configuration file.
1 | imapcopy -t |
the script will run and check the availability and correctness of the data to log.
that we begin to migrate mailbox command:
1 | imapcopy |
The problem with SSL - stunel
The problem occurs when we want to copy the e-mails with SSL encryption / TLS. The solution to this problem is to tunneling traffic from ports
We install and run two commands in separate console. So to work all the time during our copy emails.
Install the required packages:
1 2 3 4 5 | sudo apt-get install stunnel Uruchamiamy dwa terminale i wykonujemy polecenia: <pre class="">stunnel -c -f -d 1143 -r imap.foo.tld:993 -P <pre class="">stunnel -c -f -d 1144 -r imap.bar.tld:993 -P |
After running the above commands in separate terminals you need to update our configuration file imapcopy.cfg.
1 2 3 4 5 | SourceServer 127.0.0.1 SourcePort 1143 DestServer 127.0.0.1 DestPort 1144 |
It sets out the source and destination servers were on our localhost. Thanks to which all traffic is redirected from stunnel address 127.0.0.1:1143 address imap.source.net:993 after already establishing an encrypted connection.
It is nice https://imapsync.lamiral.info/ because everything can be set from the command line, no configuration files
Do not forget that this is an external tool and you never know if someone accidentally saves passwords to the box 😉
But I prefer the way I described.
What external tool? Well, a mistake, that you are thinking of a website web migrator https://imapsync.lamiral.info/X/ ?
You can download everything from GitHub and install it on your own. There are several PERL scripts (everyone is responsible for something else) and a way to put everything for your convenience on the website.
https://imapsync.lamiral.info/#install
https://github.com/imapsync/imapsync
I've been using since my dear … from many, many many years 🙂 I have already transferred several hundred TBs.