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:

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:

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.

About Renato

No Comments

Be the first to start a conversation

Leave a Reply

  • (will not be published)