Skip to main content Logo (IEC resistor symbol)logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher - Easy IMAP Email Backup.

Published: 17-11-2013 | Author: Remy van Elst | Text only version of this article

Table of Contents is a python script to backup any IMAP capable email account to abowsable HTML archive and a Maildir folder. Not one huge file (mbox), onlyneeding a web browser to view and no proprietary code, so you can make sure Iwon't steal your password.

If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)


Click here for a demo with the new interface
Click here for a demo with the old interface


Running the program

nopriv screenshot

Index page

nopriv screenshot

Folder Overview page

nopriv screenshot

Email itself

nopriv screenshot


nopriv screenshot

Empty Folder

nopriv screenshot

Command Line Client (links2):

nopriv screenshot



New in version 6: (18-11-2013)

New in version 5:

New in version 4:

New in version 3.1:

New in version 3:

New in version 2:


  1. Clone the repository:

git clone git://

  1. Set up your login details, imap server and ssl:

Edit the nopriv.ini file with your IMAP server, login and password:

[nopriv]imap_server = = xyz@googlemail.comimap_password = my_secret_passwordimap_folder = INBOX, Draft, Newletters#optionalssl = trueincremental_backup = true

If you want to use SSL to connect to IMAP, or want to use incremental backups,enable or disable the options.

If you want to backup all folders, enterNoPriv_All as imap_folder.

Nopriv.ini can be in the following locations:

If you use gmail and want to backup all your email, use the "[Gmail]/All Mail"folder. It might be named different if you use another locale, for me with aDutch gmail account it is named "[Gmail]/Alle Berichten".

  1. Execute the script:

python ./

  1. Browse the generated backup:

Open the file index.html in your browser. There are all your folders andemails.

If you only have a console, it works just fine in Links2 (see above screenshot):

links2 ./index.html


Python 2.7

Running debian 6 which has python 2.6.6? See here how to install python 2.7 ondebian 6.

Known issues

Info on incremental backups

If you disable incremental backups, the script will run over the folders, createa maildir, create the pages and then move the maildir to $ wheredate is a timestamp. If you enable incremental backup, it will create a textfile nopriv.txt with the mail ID's of the folder, so that it know which ID itneeds to continue on the next time it is ran. If you delete emails from thefolder, the incremental function will not work as expected because of differingID's.

Info on restoring

Nopriv creates a Maildir folder, which houses all your email. You can restorethis maildir folder to an IMAP account either by using the script linked at thetop on this page, or use a mail client like Mutt or Evolution and transportit to an imap account via there.

More Info:

Tags: backup, email, gmail, html, imap, imaps, maildir, mbox, python, software