Skip to main content

Mailbagit

A tool for creating and managing Mailbags, a package for preserving email in multiple formats. It contains an open specification for mailbags, as well as the mailbagit and mailbagit-gui tools for packaging email exports into mailbags.

mailbagit can be used to convert native email formats, such as PST, MSG, EML, and MBOX into PDF, HTML, WARC, and other formats and combines them into stable packages for preservation.

Installation

pip install mailbagit
  • To install PST dependancies: pip install mailbagit[pst]
  • To install mailbagit-gui: pip install mailbagit[gui]

You can also run mailbagit using a Docker image.

Quick start

Examples:

MSG files to PDF, EML, and WARC

mailbagit path/to/messages -i msg --derivatives eml pdf warc --mailbag_name my_mailbag

MBOX to PDF and plain text

mailbagit path/to/mbox_dir -i mbox -d txt pdf-chrome -m my_mailbag -r

PST to PDF, MBOX, EML, and WARC

mailbagit path/to/export.pst -i pst -d mbox eml pdf warc -m my_mailbag

EML to PDF and WARC in another directory

mailbagit path/to/messages -i eml -d pdf warc -m /path/to/my_mailbag

See the documentation for more details on:

Arguments

The arguments listed below can be entered in the command line when using mailbagitor entered in mailbagit-gui fields

Mandatory Arguments

  • path:

A path to email to be packaged into a mailbag. This can be a single file or a directory containing a number of email exports.

  • -m --mailbag:

A new directory for the mailbag, such as /path/to/my_mailbag, or just my_mailbag to use the same location as the source email. Must be a valid directory or file name and must not already exist.

  • -i --input:

File format to use as input for a mailbag. Argument takes single input. e.g. -i imap or -i pst

  • -d --derivatives:

Specifies a single or list of derivative formats that mailbagit will create and package into the mailbag. Argument takes multiple inputs. e.g. -d eml pdf warc

Mailbagit Optional Arguments

  • -v --version

Reports the version number and exits.

  • -r --dry-run

Performs a test run that will not alter any files other than writing an error report. When this flag is used, mailbagit parses all the email it is provide and formats derivatives as much as it can without writing anything to disk. If there are any error or warnings, this will create an error report with an errors.csv listing all issues as well as a full stack trace in a .txt file.

  • -k --keep

Keeps the source files as-is and copies instead of moving them into a mailbag.

  • --css

Path to a CSS file to override the included CSS when creating PDF or HTML derivatives Argument takes single file path as input.

  • -c --compress

Compresses the mailbag as a ZIP, TAR, or TAR.GZ e.g. -c zip or -c tar.gz

  • -f, --companion_files

Allows for companion metadata files to be packaged alongside email export files. When this option is used, mailbagit will recursively include all the files in the directory provided into a mailbag.

Bagit-python arguments

Mailbagit also accepts most bagit-python arguments. Thus, you can provide arguments like --processes 2 or arguments to add metadata such as --source-organization University at Albany, SUNY

The only bag-python arguments that mailbagit does not support are -log, -quiet, -validate, -fast, and -completeness_only

If you would like to validate your mailbag, mailbagit comes with bagit-python installed. Thus, you can run:

bagit.py --validate /path/to/mailbag

Development setup

git clone git@github.com:UAlbanyArchives/mailbagit.git
cd mailbagit
git switch develop
pip install -e .

Development with docker

Build and run image

docker pull ualbanyarchives/mailbagit:dev
docker run -it ualbanyarchives/mailbagit:dev

License

MIT

Kudos

This project was made possible by funding from the University of Illinois's Email Archives: Building Capacity and Community Project.

We owe a lot to the hard work that goes towards developing and maintaining the libraries mailbagit uses to parse email formats and make bags. We'd like to thank these awesome projects, without which mailbagit wouldn't be possible:

We'd also like to thank the RATOM project whose documentation was super helpful in guiding us though some roadblocks.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mailbagit-0.6.0.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mailbagit-0.6.0-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

Details for the file mailbagit-0.6.0.tar.gz.

File metadata

  • Download URL: mailbagit-0.6.0.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for mailbagit-0.6.0.tar.gz
Algorithm Hash digest
SHA256 b46ed12272d5d7d5fadd7ba8ee6d8293c11dec26c75e0df081a279ce1be89f4b
MD5 652193ca56b187e69b41a3d8ce63784e
BLAKE2b-256 d39cdfb9fce37e2e350dd61af71927730fd0284a3a7fe95a39f76167069f816a

See more details on using hashes here.

File details

Details for the file mailbagit-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: mailbagit-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for mailbagit-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59f0615774c66135892dd94c7f9c7522bca8108276616bbfd19973eafa27e7d8
MD5 a66eb4b22cbcaa5af4bff3068c1f1525
BLAKE2b-256 69577c03b9790fd8597cc874c44f1aa5ed77b6205f557c9a834679ff5a8c876b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page