Package: mailbagit
MailbagitA tool for creating and managing Mailbags, a package for preserving email in multiple formats. It contains an openspecification for mailbags, as well as themailbagitandmailbagit-guitools for packaging email exports into mailbags.mailbagitcan 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.Installationpip install mailbagitTo install PST dependancies:pip install mailbagit[pst]To installmailbagit-gui:pip install mailbagit[gui]Docker setupYou can also runmailbagitusing aDocker image.docker pull ualbanyarchives/mailbagit
wget https://raw.githubusercontent.com/UAlbanyArchives/mailbagit/main/docker-compose.yml
docker compose run mailbagit
mailbagit -vQuick startExamples:MSG files to PDF, EML, and WARCmailbagit path/to/messages -i msg --derivatives eml pdf warc --mailbag_name my_mailbagMBOX to PDF and plain textmailbagit path/to/mbox_dir -i mbox -d txt pdf-chrome -m my_mailbag -rPST to PDF, MBOX, EML, and WARCmailbagit path/to/export.pst -i pst -d mbox eml pdf warc -m my_mailbagEML to PDF and WARC in another directorymailbagit path/to/messages -i eml -d pdf warc -m /path/to/my_mailbagSee thedocumentationfor more details on:mailbagitmailbagit-guiloggingpluginsArgumentsThe arguments listed below can be entered in the command line when usingmailbagitor entered inmailbagit-guifieldsMandatory Argumentspath: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 justmy_mailbagto 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 imapor-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 warcMailbagit Optional  Arguments-v --versionReports the version number and exits.-r --dry-runPerforms a test run that will not alter any files other than writing an error report. When this flag is used,mailbagitparses 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 anerrors.csvlisting all issues as well as a full stack trace in a.txtfile.-k --keepKeeps the source files as-is and copies instead of moving them into a mailbag.--cssPath to a CSS file to override the included CSS when creating PDF or HTML derivatives
Argument takes single file path as input.-c --compressCompresses the mailbag as a ZIP, TAR, or TAR.GZ
e.g.-c zipor-c tar.gz-f, --companion_filesAllows for companion metadata files to be packaged alongside email export files.
When this option is used,mailbagitwill recursively include all the files in the directory provided into a mailbag.Bagit-python argumentsMailbagit also accepts mostbagit-pythonarguments. Thus, you can provide arguments like--processes 2or arguments to add metadata such as--source-organization University at Albany, SUNYThe only bag-python arguments thatmailbagitdoes not support are-log,-quiet,-validate,-fast, and-completeness_onlyIf you would like to validate your mailbag,mailbagitcomes withbagit-pythoninstalled. Thus, you can run:bagit.py --validate /path/to/mailbagDevelopment setupgit clone git@github.com:UAlbanyArchives/mailbagit.git
cd mailbagit
git switch develop
pip install -e .Development with dockerThis runs the dev docker image with the code installed in editable mode. You can then make code changes and run them directly withmailbagit.Assumes you have a directory with email data in ./sampleData. You can change this directory name inline 7 of docker-compose-dev.yml.docker pull ualbanyarchives/mailbagit:dev
git clone git@github.com:UAlbanyArchives/mailbagit.git
cd mailbagit
git switch develop
docker-compose -f docker-compose-dev.yml run mailbagit
mailbagit -vLicenseMITKudosThis project was made possible by funding from the University of Illinois'sEmail Archives: Building Capacity and Community Project.We owe a lot to the hard work that goes towards developing and maintaining the librariesmailbagituses to parse email formats and make bags. We'd like to thank these awesome projects, without whichmailbagitwouldn't be possible:extractMsglibpffbagit-pythonWe'd also like to thank theRATOM projectwhose documentation was super helpful in guiding us though some roadblocks.