Export your remote IMAP4 folders to local "mbox" file

I have created this simple utility because i want to backup my IMAP4 mailbox (due to a domain transfer). Looking on the net, i'm unable to find something suitable for my needs so i take my IDE and start writing some Python code that help me doing that.
imap2mbox simply connects to remote IMAP4 server and recursively saves all directories (and related messages) to mbox files. After, you can use MHonarc to create an HTML archive ready to be burned into CDs ! If you don't need all fantastic MHonarc features, you can try the new HTML export (from 1.4.0).


If you have python, just download it here (v1.5.0) !

Peter Huewe check imap2mbox with pylint and then wrote to me:
I found your little script on google and while I had a look at it I noticed that you mixed spaces and tabs for indenting - this is very confusing if you set your tabstop to e.g. 4

I attached 2 versions - one with minor fixes (tabs -> spaces, added docstrings, wrapped lines at 80 chars) and one with new variable naming according to PEP 8

I would be glad if you could publish v1 or v2 on your homepage
Thanks Peter !

Freundiny (13/04/2014 14:33:44) say:

Live Camsex mit geilen Ludern. Sexy EX-freundin umsonnst testen. Mature Sex aus ganz Deutschland. Live Sex mit scharfen Nutten. EX-freundin Porn umsonnst testen. Mature Sex aus ganz Deutschland. EX freundin sucht dich Suche erotisches Treffen Heute Fremdgehen Ich will es besorgt bekommen Ich will fremdgehen

Laurettasic (25/11/2013 00:14:13) say:

Good day! site offers quality

jCMEyFhGfz (11/03/2013 23:06:12) say:

buy ativan generic version ativan - generic drug for ativan

bofajoguve (06/02/2012 05:58:03) say:

Gently rake the soil again to incorporate the soil, fertilizer, and seed. Think of it this way. A lot of marketing campaigns go wrong because they are way too focused on a "push" strategy. needler Once you have determined that the lettuce is bug free, make sure it is served on a cold clean (or disposable) place and that no "sharp" foods such 4s onions, radishes, lemon, etc.Dressings also pose problems. One of their best-known innovations is the Quantum System.

HelgaBolton34 (23/09/2011 10:48:13) say:

I had a dream to begin my own commerce, however I didn't have got enough of money to do this. Thank heaven my friend recommended to utilize the credit loans. Thence I used the credit loan and realized my desire.

chamanRM (04/08/2011 11:12:08) say:

There is a binary for windows?

Aaron (21/09/2010 10:25:59) say:

Error fixed. It was necessary then updated the libmail-imapclient-perl package. Thanks! ;)

Steeve McCauley (14/08/2010 16:52:13) say:

I can also report that the -f option seems to be ignored with gmail :( ./ -s -p 993 -m -u myuser -f '[Gmail]/All Mail' -v I just wanted to archive the All Mail folder, but it is downloading every folder separately. I might also recommend adding a --version switch but according to the tarball this is version 1.5.0.

TishaBlankenship (24/07/2010 13:29:34) say:

Buildings are not cheap and not everybody is able to buy it. However, mortgage loans was created to aid people in such kind of situations.

Aaron (23/07/2010 12:26:37) say:

hi Michele, thanks for your python script, but I get the next error 'ERROR: IMAP4 error sslerror(1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol')', I try without SSL but then the error is 'ERROR: IMAP4 error error("LOGIN command error: BAD ['Command received in Invalid state.']",)' Thanks you very much

Noel (26/10/2009 18:57:03) say:

Hi Michele, Fantastic program - but it seems to ignore my folder filter? I enter "./ -f Spam\ Mail" and it still downloads my entire IMAP tree? Thanks

Jens (09/02/2009 16:02:09) say:

This is great... Somehow it ignores my password (-w PASSWORT)...

Thomas (25/01/2009 00:27:13) say:

Too bad it bails out when trying to download my gmail account when coming to the folder "[gmail]"...

Matthew Stier (20/11/2008 04:44:00) say:

Nearly Perfect. To make it Mozilla compliant, I need to modify it to leave the filenames alone, and add a suffix (.sbd) to the directories.

Rob (19/11/2008 04:54:00) say:

Nice work. A suggestion if I may, how about a resume option (or update) to download any new emails for an offsite backup purposes? Thanks

Steve Emms (02/09/2008 20:19:22) say:

imap2mbox has been featured at

Joao Lyma (01/09/2008 17:41:00) say:

[From Brazil] Perfeito!!! Muito obrigado. (Perfect!!! Thanks so much.)
Leave a feedback !
Your name:

Please note: your IP will be registered for security reasons.