Copy Horde emails to another server with Horde installed

Horde email sync and exportProblem: You have Horde emails stored on one server and wish to copy them to another.  This is often as part of a server upgrade, say from reseller to VPS or Dedicated Server.

You may want to keep the client up and running on the old webmail until they can go live onto the new domain.  I looked into many ways to do this.  First off, exporting the emails via Horde seemed the best option.  Problem is, the reseller account they had kept timing out and there were 1200 emails and attachments totalling 2GB to copy over.  If your setup is smaller, you could try exporting like this:

Copy Horde emails using the MBOX download method

  • Click on Mail (left column)
  • Folders (top bar)
  • Select the folder you wish to export, eg Inbox
  • In the “Choose Action” dropdown menu select “Download”
  • OK the message about it taking time.

You will now have that folder stored on your hard drive to export back to the new Horde installation.

To import simply repeat the above but from the “Choose action” dropdown menu, select Import Messages, then Browse to the folder on your PC and select “Import”. Make sure you have selected the correct target folder first.

Copy emails to Horde using IMAP and fetch mail

You can also try adding the settings for your IMAP server directly into Horde’s ‘Fetch mail’ function.  I find this flaky on many server setups and the import usually does not work on larger mailboxes.

  • Options
  • Fetch Mail
  • Edit your preferences for accessing other mail accounts
  • Create a new account
  • IMAP
  • Fill in your other server’s IMAP details
  • Create

A better way to avoid server limitations

Memory limitations on reseller accounts are a problem.  Copying 1GB of data required much more memory on the last reseller account I had to copy from. Here’s a typical error:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 9817178 bytes) in /usr/local/psa/psa-horde/imp/lib/Folder.php on line 600

Now my way of doing this (if you get an error using the folder import or fetch mail methods) is to use a third party app to download emails from one place and upload them to the new place.  I have tried quite a few including the command line IMAPcopy etc but none worked first time every time like this.  What is it I hear you cry….?  Thunderbird!  Yes that’s right. The free and stable Mozilla Thunderbird email client.

How to use Thunderbird to copy email accounts from Horde to Horde

Download and install Thunderbird.  Simply create an IMAP account that links to server 1 (we’ll call it “Source”).  Create another for server 2 (we’ll call it “Destination”).  Test that both accounts function correctly (you can send an email from your own email account to both and watch them appear in Thunderbird).  Allow the emails on server 1 time to fully download and check the total mails against the reported total in Horde.

Then, in the first account (Source), use CTRL-A to select all of the emails in the Inbox folder. Now, holding the CTRL key (so it duplicates not moves!), drag and drop the selected emails to the destination folder (eg Inbox on Destination).  Now you can see the upload of the source files to the destination server.  Done!

Bear in mind this will be restricted by your upload speed, so it could be a couple of hours for a few GB of files and attachments.  Thing is, this works so well you can leave it running overnight if required,  and you also get a bonus working backup of the emails during transfer.  I’m amazed that it needs a solution like this but hey-ho, I’m happy I found a solid solution to a common problem.

Your comments please!

3 thoughts on “Copy Horde emails to another server with Horde installed

  1. Brilliant and well explained method. Thought I had lost all of the emails as they simply couldn’t be imported onto the new server without errors.
    Thanks (small tip left in your coffee fund!)

  2. Wow, as the comment above says, very well explained.

    Thought I had lost the lot but your Thunderbird method worked really well for me. Genius!

Leave a Reply

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