Citadel? Courier? Cyrus? Dovecot? - I just want to backup my emails

Jan 01, 2026 Last reply: 5 months ago 73 Replies

Hi everyone



and happy new year!



I am in contract with a webhoster, having webserver, email and a few other things.



But, there is no way to backup my emails stored on their imap server. Meaning, when anything happens to that infrastructure (or they go broke) then all my emails are gone.



So, I'd like to mirror them via imapsync to a local instance of some imap server, and then pack them together as a tgz archive.



Now I see, that there are several solutions out, see subject, and I don't know which one fits best and what component is needed.



Does anyone have some experience here? Do I need an mta (exim for instance) to just sync emails from external imap server to local?



Thanks for any hint!



Best regards,



Markus


I use POP3 for fetching mail from the public-facing server onto my own machine. So the only mail store that needs backing up is already under my control.

Dovecot is fairly easy to set up. I’ve not tried the other IMAP servers.

I’ve never used imapsync but there’s no reason copying messages from one IMAP server to another should require an MTA.

Personally I'd ignore all those "solutions" as overkill and use movemail from GNU Mailutils:

movemail -v imaps://no snipped-for-privacy@dipl-ing-kessler.de mh:///home/[user]/Mail

If you have special characters like '@' in the username, you may need to percent-encode them, eg. "%40".

formatting link
I use MH format for storing the mail, check what format/s your email client understands and change "mh://" to suit.

formatting link
I actually use POP to get mail using movemail myself, but it works with IMAP too.

I use Cyrus and like it. It saves the mail as text files. The metadata information (folder permissions, read status etc.) is saved in local databases.

Hi Kev,

movemail seems to work, thanks!

Well, in the document mh was misspelled as 'mh://Mail' instead of 'mh:///Mail', so it took a while until I got it to work.

Anyway, is there an option to automatically transmit content of more than

1 folder, i.e. inbox, draft and sent... at once?

Best regards, Markus

What is this "mh:" in a URL? Never saw that before. Is that part of the generic URL specification? Or is this a quirk of the "movemail" program?

I guess I need to get out "man movemail" or see what's in /usr/share/docs ...

"mh A local mailbox in the MH format. User and pass are not used. Host-or- file-name denotes the name of MH folder, e.g., mh://Mail/inbox."

see

formatting link

Is there a sample configuration out, to not having to start from scratch by "trial and error"?

Thank you!

Apparently, GNU-Mailutils is not in the Fedora distribution. There are RPMs for it in SuSE, but I am reluctant to mix "foreign" RPMs into my Fedora; I have seen that greate small messes in dependencies. And I really don't like to compile from sources.

Besides this, it looks like movemail can only transmit 'Inbox' but no other folders?

I think you have to run a separate movemail command for each folder (and pointing to each destination folder). But you could put them in a script and have it add the password or set it in ~/.mu-tickets so you don't have to enter it manually multiple times.

Maybe you should switch to a more comprehensive distro?

formatting link

And what’s with this reluctance to compile from source, anyway? It’s part of the bread and butter of running any Linux distro.

No, just add the folder to the URL, such as:

movemail imaps:// snipped-for-privacy@example.com/draft mh:///tmp/Mail/draft

I just tested that and it works for me. I can't see any way to download all the folders with one command like you asked before though.

By the way, if you want to keep the messages on the server, you probably want to use the "--sync=uidnext" option:

formatting link

..and use & to background each folder transfer to spawn many shells to move it sorta concurrently...

Maybe, but it might also get you blocked for too many connections to the IMAP server.

Yes, this way, download by foldername works, thanks!

When wanting the emails to remain on the server, flag '-p' (keep messages) can be used. What does "--sync=uidnext" differently?

B.t.w., just trying to download folders with special characters in them, like "Entwürfe" (drafts). I did not make it yet to get this encoded (for instance "ü" in html: ü)

As explained at the link, adding "--sync=uidnext" avoids re-downloading old messages that have already been retrieved when you run it again.

With percent encoding that character turns into "%FC", or "%C3%BC" if it uses UTF-8. There's a conversion table here:

formatting link

The default config of Debian is reasonable. If you want mine, let me know.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required