Skip to main content

Raymii.org Raymii.org Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed | Gopher

NoPriv.py - Easy IMAP Email Backup.

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


❗ This post is over nine years old. It may no longer be up to date. Opinions may have changed.

Table of Contents

  • Info on restoring

  • NoPriv.py is a python script to backup any IMAP capable email account to a bowsable HTML archive and a Maildir folder. Not one huge file (mbox), only needing a web browser to view and no proprietary code, so you can make sure I won't steal your password.

    Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:

    I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!

    Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.

    You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.

    Demo

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

    Screenshots

    Running the program

    nopriv screenshot

    Index page

    nopriv screenshot

    Folder Overview page

    nopriv screenshot

    Email itself

    nopriv screenshot

    Attachments

    nopriv screenshot

    Empty Folder

    nopriv screenshot

    Command Line Client (links2):

    nopriv screenshot

    Features

    Changelog

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

    New in version 5:
    (13-11-2013)

    New in version 4:

    New in version 3.1:

    New in version 3:

    New in version 2:

    Usage

    1. Clone the repository:

    git clone git://github.com/RaymiiOrg/NoPriv.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 = imap.gmail.com
    imap_user = xyz@googlemail.com
    imap_password = my_secret_password
    imap_folder = INBOX, Draft, Newletters
    
    #optional
    ssl = true
    incremental_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 a Dutch gmail account it is named "[Gmail]/Alle Berichten".

    1. Execute the script:

    python ./nopriv.py

    1. Browse the generated backup:

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

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

    links2 ./index.html
    

    Requirements

    Python 2.7

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

    Known issues

    Info on incremental backups

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

    Info on restoring

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

    More Info:

    https://raymii.org/s/software/Nopriv.py.html
    https://github.com/RaymiiOrg/NoPriv

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