imapsync mailbox migration from Plesk to Hestia

usually,Maybe not many people will encounter this situation,That means you want to change your email address,But you need to bring the emails in your current mailbox with you。But once it happens,You will find,Something that is almost the same age as the Internet,There is no mature export and import function。

What's more troublesome than this is,If you are a mail server administrator,You find out tragically,It doesn’t work even if you have server permissions.。The content in the mailbox is stored using special methods,It is not a simple database,Requires the use of corresponding services for access,Moving files directly is likely to cause data corruption,The gain outweighs the loss。 imapsync It comes in handy,It uses email directly IMAP protocol,Download data from old mailbox,Then sync to new mailbox,The sender of the message,recipient,time,Accessories, etc. are all available!

problem

of course,If it were that simple it would be over,Then the point of this article is gone - I have a more complex use case,My client needs to migrate their mailboxes to a new server,Use new panel,That is,Migrate from Plesk to Hestia。 So the question is,There is only one domain name,How can I get from A to B but only using A?

Finally my solution was to create a temporary mailbox,Use domain name B,So I can sync emails from A to B first,Then modify the domain name configuration,Resolve domain name to new server,Then synchronize emails from B back to A。Because the domain name has been resolved to the new server at this time,In fact, the mail is synchronized to the new mail server.。Then use the same account and password for users created on the new server.,In theory, customers don’t need to make any changes,Just tolerate a short service outage and you'll be fine。

Configuration / pitfalls

There is some additional configuration that needs to be done,by default,If you open Hestia's webmail,You will see an internal error,This is due to file permissions,Use the following two commands to fix:

Other,If your mailbox can successfully send emails but cannot receive them,Need to view Exim4 Journal: /where/log/exim4/rejectlog ,If there is an error similar to the following:

That's most likely because Exim4 uses the default spamhaus List is too aggressive。 In my test,It will directly block any gmail email,we can remove it。edit /etc/exim4/dnsbl.conf Remove zen.spamhaus.org Just save this line。Then restart Exim4 using the command systemctl restart exim4

imapsync

If you happen to use it like me macOS if,Please do not use homebrew Install imapsync 2021 start of year,The imapsync installed by brew has a strange memory leak problem,This problem has not been fixed yet (yes,I also encountered it)。The convenient and worry-free solution is to install the dependencies and run it directly on Ubuntu。Of course, if you find it troublesome,You can also use Docker,Here I found oneImage that supports arm64 You can use this image directly to run imapsync,Stable and efficient!

Here is an example of the command I use:

It is noteworthy that,Your password should be enclosed in double quotes,This can avoid command errors caused by some special symbol conflicts.。

Other,It is highly recommended to run this command on your new server,Because imapsync will download and upload everything - including attachments。This will be a very long operation。Ideally run on your new server,This way the data can be downloaded directly to your server,Then store it locally in the database。Especially if I need to synchronize two mailboxes on the same server later.,And the upload capacity of ordinary home broadband is very small.,What a big hole。

Spam and antivirus function switch

Configure Hestia spamassassin and clamaav 。If you are like me and use Lightsail with small memory as your server,So even if you check these two modules,They may also not be installed,At this time we need to install them manually: sudo apt install spamassassin clamav clamav-daemon

edit Hestia configuration file sudo we /usr/local/hestia/conf/hestia.conf ,Add the following two lines at the beginning of the file:

Enter settings in the Hestia administrator account interface→exim4 The editing interface,place the following 4 Uncomment the line:

Uncomment spam and antivirus related configurations

Uncomment spam and antivirus related configurations

Then execute the following commands line by line to configure clamav

There is also the following command configuration spamassassin

Last edited file /etc/roundcube/config.inc.php ,Add the following at the top:

Restart the server,Then you can Hestia In the mailbox configuration interface, you can see the spam and anti-virus switches.。

Original article written by LogStudio:R0uter's Blog » imapsync mailbox migration from Plesk to Hestia

Reproduced Please keep the source and description link:https://www.logcg.com/archives/3853.html

About the Author

R0uter

The non-declaration,I have written articles are original,Reproduced, please indicate the link on this page and my name。

Leave a Reply

Your email address will not be published. Required fields are marked *