This is a text-only version of the following page on https://raymii.org:
---
Title : NoPriv.py - Easy IMAP Email Backup.
Author : Remy van Elst
Date : 17-11-2013
URL : https://raymii.org/s/software/Nopriv-IMAP-backup.html
Format : Markdown/HTML
---
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 $200 credit for 60 days. Spend $25 after your credit expires and I'll get $25!
### Demo
[Click here for a demo with the new interface][2]
[Click here for a demo with the old interface][3]
### Screenshots
#### Running the program
[![nopriv screenshot][4]][4]
#### Index page
[![nopriv screenshot][5]][5]
#### Folder Overview page
[![nopriv screenshot][6]][6]
#### Email itself
[![nopriv screenshot][7]][7]
#### Attachments
[![nopriv screenshot][8]][8]
### Empty Folder
[![nopriv screenshot][9]][9]
#### Command Line Client (links2):
[![nopriv screenshot][10]][10]
### Features
* Works with any IMAP/IMAPS account
* Supports multiple IMAP folders
* Supports text, HTML and multipart email
* Saves attachments
* Supports incremental backups
* Backups to HTML files for easy browsing
* Small HTML files can be backed up to external medium more easily, and can be sent over the internet more easily.
* Backs up to Maildir for [easy restoring][11]
### Changelog
New in version 6: (18-11-2013)
* Add support to download all folders without typing them all out. Using "NoPriv_All" as foldername now downloads all available folders.
* Fix quite a few HTML errors
* Converted layout from HTML Kickstart to Twitter Bootstrap
* Add offline mode (only converts the Maildir to HTML, does not try to download new email)
New in version 5:
(13-11-2013)
* Fix issue #22, NoPriv does not crash on empty IMAP folders anymore
* Fix issue #23, NoPriv now tries a few times when the IMAP connection is reset. This happens with Google Mail sometimes.
New in version 4:
* INI style config, either per user or system wide (thanks to [https://github.com/brejoc][12])
New in version 3.1:
* Added a sample `muttrc` file to view NoPriv with the Mutt mail client.
New in version 3:
* Supports incremental backups
* If you stop the backup while running, it will now continue were it left off
* Unread mails stay unread, but are backed up (before they were marked as read)
* Restoring possible because it also creates a Maildir
* Better unicode support
* Attachment page is now also styled
New in version 2:
* Support for multiple IMAP folders
* Index page is generated
* Pages have menu now.
* On running it shows all available IMAP folders.
### 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, enter`NoPriv_All` as imap_folder.**
`Nopriv.ini` can be in the following locations:
* './nopriv.ini'
* './.nopriv.ini'
* '~/.config/nopriv.ini'
* '/opt/local/etc/nopriv.ini'
* '/etc/nopriv.ini'
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.][13]
### Known issues
* Does not work with python3 (Feel free to port/fix it.)
* Does not handle all charsets. Works best with utf-8 and ascii.
* No search function.
* Not able to change default sorting (latest first).
### 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][14], or use a mail client like Mutt or Evolution and transport
it to an imap account via there.
### More Info:
[1]: https://www.digitalocean.com/?refcode=7435ae6b8212
[2]: http://sparklingnetwork.nl/nopriv2/index.html
[3]: http://sparklingnetwork.nl/nopriv/index.html
[4]: http://i.imgur.com/8Uvrk.png
[5]: http://i.imgur.com/mQOrv8ih.png
[6]: http://i.imgur.com/7gWFky1h.png
[7]: http://i.imgur.com/0765Xz1.png
[8]: http://i.imgur.com/jAdGeeM.png
[9]: http://i.imgur.com/NigeQ9lh.png
[10]: http://i.imgur.com/gt9nH.png
[11]: https://raymii.org/s/software/Ruby_script_to_upload_or_convert_a_Maildir_Inbox_to_an_IMAP_server.html
[12]: Jochen%20Breuer
[13]: https://raymii.org/s/tutorials/Install_Python_2.7_or_3_on_debian_6.html
[14]: https://raymii.org/s/software/Ruby_script_to_upload_or_convert_a_Maildir_Inbox_to_an_IMAP_Server.html
---
License:
All the text on this website is free as in freedom unless stated otherwise.
This means you can use it in any way you want, you can copy it, change it
the way you like and republish it, as long as you release the (modified)
content under the same license to give others the same freedoms you've got
and place my name and a link to this site with the article as source.
This site uses Google Analytics for statistics and Google Adwords for
advertisements. You are tracked and Google knows everything about you.
Use an adblocker like ublock-origin if you don't want it.
All the code on this website is licensed under the GNU GPL v3 license
unless already licensed under a license which does not allows this form
of licensing or if another license is stated on that page / in that software:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Just to be clear, the information on this website is for meant for educational
purposes and you use it at your own risk. I do not take responsibility if you
screw something up. Use common sense, do not 'rm -rf /' as root for example.
If you have any questions then do not hesitate to contact me.
See https://raymii.org/s/static/About.html for details.