Installing ONLYOFFICE Workspace Enterprise Edition and configure Mail Server
Install the Docker version of ONLYOFFICE Workspace Enterprise Edition. This can be done installing ONLYOFFICE Workspace Enterprise Edition using the script and selecting the Docker installation variant. After that set up the mail server as written here.
When connecting the domain, you will need to set the same domain as has been used for email messaging with MS Exchange (the domain from the user email addresses). If you need to change the domain name, you need to additionally edit the
users.csv
file (which was received in the step above), replacing all the entries for the old MS Exchange domain with the new one. This is done with the following command:
sed -i 's/exchange-domain.com/new-domain.com/g' users.csv
Where
exchange-domain.com
is the old domain name used with MS Exchange, and
new-domain.com
is the new one you are now going to use.
Downloading script and installing/updating dependencies
Now you need to download and unpack the script which will do the data import process. This can be done using the command:
wget -O "ImportExchangeData.tar" "https://help.onlyoffice.co/products/files/httphandlers/filehandler.ashx?action=view&fileid=5549294&version=0&doc=TWVPQks1aUo2MEprc0tkbUF6K2Y4Um1OSi9tTkd6V0lyTHFocG0xZHE0QT0_IjU1NDkyOTQi0" && tar -xvf ImportExchangeData.tar && cd ./Import
The command will download and unpack the file, creating the following folder structure:
Import
|-lib
|---create_users.py
|---mbox2imap.py
|---mapping.json
|---pst2mbox.sh
|---get-mailboxes.sh
|---install-passfinder.sh
|---ASC.Mail.PasswordFinder.tar
|-ImportExchangeData.py
|-requirements.txt
You will need Python v2.7 installed. It is often installed by default with various Linux distributions, but in case it is missing, you will need to install it yourself. This is how it is done for Debian-based distributions:
# apt install python
# python -V
Python 2.7.12
Install the pip (package manager), also necessary for the correct script work:
# apt install python-pip
# pip -V
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
And install the other required packages:
pip install -r requirements.txt
Running the script
Now you can run the script specifying the necessary parameters:
./ImportExchangeData.py -d "<portal domain>" -u "<portal administrator email>" -pw "<portal administrator password>" -f <path to the folder with the exported data>
If your portal is connected using HTTPS, you will need additionally use the -s "https"
parameter when running the code.
Replace the parameters in brackets with your own portal data and run the script:
./ImportExchangeData.py -d myportal.com -u "my.email.address@gmail.com" -pw "123456" -f /root/Temp/
Wait for the script to finish working. It might take some time depending on the number of users and the amount of their data.
Script work results
When the script does everything it is intended for, the results will be the following:
- the new portal users with the email adresses from the
users.csv
file will be created;
- the mailboxes at the ONLYOFFICE Mail Server will be created, which will have the mail messages from MS Exchange and will be connected in the ONLYOFFICE Mail module for the users listed in the
users.csv
file;
results-ok.txt
file will be saved to the Import
folder, it will contain the list of all user accounts from the users.csv
file and their passwords, which were successfully created;
result-err.txt
file will be saved to the Import
folder, it will contain the list of all user accounts from the users.csv
file, which had problems when they were imported and created;
mailboxes.json
file in the JSON
format will be saved to the Import
folder, it will contain the list of settings necessary to connect to the newly created mailboxes from the third-party mail clients.
If you create some mailboxes after the import, you can also get the settings necessary to connect them to the third-party mail client programs. Go to the
ImportExchangeData.py
folder and run the command:
bash ./lib/get-mailboxes.sh -j
The
mailboxes.json
file will be overwritten with the new mailboxes data.
Show what the ImportExchangeData.py script does
Hide
- When run, the script sets the main working files and folders: both for the files and folders necessary for the output files and the folder with the input data (which has been exported from MS Exchange).
- At the next step the script creates the users and then their mailboxes.
- Then the script converts the exported files into the
mbox
format.
- When done, the script installs the
ASC.Mail.PasswordFinder
program which will assist in creating the mailboxes.json
file containing the list of settings necessary to connect to the newly created mailboxes from the third-party mail clients.
- After that the
mailboxes.json
itself is created.
- And finally the
mbox
format files are imported to the mailboxes via IMAP.