E-mail backup with NoPriv.py

Listening to the Linux Action Show podcast, I heard about a Python script to backup e-mails from IMAP accounts that downloads messages and attachments and offers everything on a nice local HTML page.

The script is called NoPriv.py and can be found on this page and on this Github repository. Given an IMAP e-mail account and a list of folders to be copied, it creates the HTML files structure to access the messages as shown in this demo page. The backup can be made incrementally, transfering only the new messages each time the script is run.

To install it, just clone the Github repository and ajust the configurations on the nopriv.py file:

###########################
# Do not edit above here  #
###########################

IMAPSERVER = "imap.gmail.com"
IMAPLOGIN = "janeway@gmail.com"
IMAPPASSWORD = "Voyager1"
IMAPFOLDER = ["[Gmail]/Sent Mail", "INBOX", "[Gmail]/Starred", "Captains_Log",
              "Important"]
ssl = True
incremental_backup = True

###########################
# Do not edit below here  #
###########################

The list IMAPFOLDER must contain the names of the folders that are going to be copied. It is worth noticing that when using Gmail server, the default folder names must be preceded by the [Gmail] prefix whereas the names of the folders created by the user must not have this prefix.

To start the copy, just run:

python nopriv.py

When finished, just open the index.html file and navigate through the messages and attachments. The file can also be opened on command line navigators such as Liks2.

Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>