Objective:
Because the company's old mail server operating system version is too low, so after upgrading to a new version of the operation, we have deployed a different mail domain (temporary) mail server on the new server, in order to reduce the impact on the business, we first stop the business of the mail server updates, and using Imapsync to the original mail server all the mailboxes are migrated to the new mail server, the migration is very fast, after the migration is complete, we test the new mail server, when it can be used normally, we switch the new domain name to the new mail server.
What's Imapsync?
Imapsync can implement mail server Migration, support IMAP mailbox, it is used to synchronize two IMAP mailbox (only suitable for migrating mailbox or backup, not suitable for synchronizing two IMAP accounts with user access)
Install Imapsync (can be installed on any server to be synchronized or on a third-party server), where we install to the new mail server and use the following command:
Yum Install Imapsync
The use of Imapsync can be performed "Imapsync--help" for viewing, because it is very simple, so here is a reference example:
#!/bin/bash-
#usage: time/$path/imapsync_mail.sh >/root/sync_mail.log
Mail_accounts= (
zhangdh1113
Lance
Linuxblind
)
Accounts_passwd= (
' [Email protected] '
' [Email protected] '
' [Email protected] '
)
I=0
While [$i-lt ${#mail_accounts [@]}];d o
# uid= ' Id-u ${mail_accounts[$i]} 2>/dev/null '
# if [$?-eq 0]; Then
# echo "usesrname \" ${mail_accounts[$i]}\ "already exist with its ID \" $uid \ "" >&2
# exit 1
# fi
# Useradd ${mail_accounts[$i]}
# echo "${accounts_passwd[$i]}" |passwd--stdin ${mail_accounts[$i]}
# echo "User \" ${mail_accounts[$i]}\ "was created successfully!"
#userdel ${mail_accounts[$i]}
#rm-rf/home/${mail_accounts[$i]}
/usr/bin/imapsync--host1 mail.a.com--user1 ${mail_accounts[$i]}--password1 ${accounts_passwd[$i]}--host2 mail.b.com--user2 ${mail_accounts[$i]}--password2 ${accounts_passwd[$i]}--delete2folders--delete2 >>/root/ Imap_sync.log 2>>/root/imap_sync.error.log
Let i++
Done
Exit 0
Of course, in some cases, the mb2md.pl tool can implement this function as well.
This article is from the "Zhangdh Open Space" blog, so be sure to keep this source http://linuxblind.blog.51cto.com/7616603/1711920
Imapsync enables migration and backup of mailboxes within two different mail domains