- Home
- Workspace
- Installation
- Installation
- Docker
- Synchronizing new mailboxes with old ones using a script
Synchronizing new mailboxes with old ones using a script
Starting from v1.6.57, it is possible to run a script after the container is started to change default settings of the onlyoffice-mail-server.
If you want to transfer mailboxes from one mail server to the ONLYOFFICE Mail Server, first you need to create the same mailboxes using the script /usr/src/iRedMail/tools/scripts/create_mailboxes.py and then perform the synchronization. To do that:
Execute the following command:
docker exec -it onlyoffice-mail-server bashGo to the directory that contains scripts:
cd /usr/src/iRedMail/tools/scripts/Prepare the csv file which contains a list of connection settings for new and old mailboxes and save it to the csv format, for example, imapsync_users.csv.
Below is an example of the imapsync_users.csv file:
host1,user1,password1,host2,user2,password2mx1.example.com,zzz@example.com,pwd123,mx2.example.com,zzz@example.com,pwd123mx1.example.com,yyy@example.com,qwerty12,mx2.example.com,yyy@example.com,qwerty12
Where host1 (for example, mx1.example.com) - is a domain which has been specified when creating the mail server in the onlyoffice-mail-server container, and host2 - is a domain of the old mail server. Other parameters are set in the same way.
Execute the script to synchronize mailboxes:
python imapsync_batch.py imapsync_users.csvIf you want to test the script without the synchronization, you should pass the —dry parameter:
python imapsync_batch.py imapsync_users.csv —dryTo find out how to perform other operations using the script, you can refer to the following articles: