Skip to content

Commit

Permalink
Name switch (UAlbanyArchives#170)
Browse files Browse the repository at this point in the history
* renamed mailbag to mailbagit

* addressed odd decode_header behavior

* updates the data after header encoding handling and turns off auto creating new data before testing
  • Loading branch information
gwiedeman authored May 12, 2022
1 parent df95d6c commit 51e9832
Show file tree
Hide file tree
Showing 52 changed files with 181 additions and 178 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/mailbag-component.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Mailbag Component
about: Describes components of the Mailbag tool for assignment
name: Mailbagit Component
about: Describes components of the Mailbagit tool for assignment
title: "[Component Name]"
labels: ''
assignees: ''
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Please check if your PR fulfills the following requirements:
**Python Version:**

## Licensing
- [ ] I agree that the Mailbag Project and the University at Albany, SUNY can release this code under the [MIT license](https://github.com/UAlbanyArchives/mailbag/blob/main/LICENSE).
- [ ] I agree that the Mailbag Project and the University at Albany, SUNY can release this code under the [MIT license](https://github.com/UAlbanyArchives/mailbagit/blob/main/LICENSE).
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ jobs:
pip install libpff-python==20211114
- name: Test with pytest
run: |
python dumpData.py data
pytest -vv
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ ENV TZ=America/New_York \
MAILBAG_LOG_LEVEL=debug\
IN_CONTAINER=true

RUN mkdir /mailbag
WORKDIR /mailbag
ADD . /mailbag/
RUN mkdir /mailbagit
WORKDIR /mailbagit
ADD . /mailbagit/

# manually add to $PYTHONPATH because https://github.com/python/importlib_metadata/issues/364
ENV PYTHONPATH=/mailbag
ENV PYTHONPATH=/mailbagit

RUN apt-get -y update && \
apt-get -y upgrade && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ RUN apt-get -y update && \
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt-get install -y /tmp/google-chrome-stable_current_amd64.deb && \
\
pip install mailbag[pst]
pip install mailbagit[pst]
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Mailbag
# Mailbagit

A tool for creating and managing Mailbags, a package for preserving email in multiple formats. It contains an open [specification for mailbags](https://archives.albany.edu/mailbag/spec/), as well as the `mailbagit` and `mailbagit-gui` tools for packaging email exports into mailbags.

## Installation

```
pip install mailbag
pip install mailbagit
```

* To install PST dependancies: `pip install mailbag[pst]`
* To install `mailbagit-gui`: `pip install mailbag[gui]`
* 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](https://archives.albany.edu/mailbag/docker).

Expand Down Expand Up @@ -40,8 +40,8 @@ See the [documentation](https://archives.albany.edu/mailbag/use/) for more detai
### Development setup

```
git clone [email protected]:UAlbanyArchives/mailbag.git
cd mailbag
git clone [email protected]:UAlbanyArchives/mailbagit.git
cd mailbagit
git switch develop
pip install -e .
```
Expand All @@ -51,19 +51,19 @@ pip install -e .
Build and run image

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

#### Building a release

##### Building and pushing Docker images

```
docker build -t ualbanyarchives/mailbag:latest -f Dockerfile.production .
docker build -t ualbanyarchives/mailbag:dev .
docker push ualbanyarchives/mailbag:latest
docker push ualbanyarchives/mailbag:dev
docker build -t ualbanyarchives/mailbagit:latest -f Dockerfile.production .
docker build -t ualbanyarchives/mailbagit:dev .
docker push ualbanyarchives/mailbagit:latest
docker push ualbanyarchives/mailbagit:dev
```

## License
Expand Down
16 changes: 8 additions & 8 deletions branching_workflow.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Mailbag Branching Workflow
# Mailbagit Branching Workflow

## Find an Issue

* Review the [project](https://github.com/UAlbanyArchives/mailbag/projects/1)
* Select an [issue](https://github.com/UAlbanyArchives/mailbag/issues)
* Review the [project](https://github.com/UAlbanyArchives/mailbagit/projects/1)
* Select an [issue](https://github.com/UAlbanyArchives/mailbagit/issues)
* Identify the Issue number

<img src="persona_images/issue_number.png" alt="Screenshot showing where the issue number is on Github" width="500px"/>
Expand All @@ -24,7 +24,7 @@ git branch -a

## Creating a new feature to address the issue

1. Move the issue to "in progress" in the [project](https://github.com/UAlbanyArchives/mailbag/projects/1)
1. Move the issue to "in progress" in the [project](https://github.com/UAlbanyArchives/mailbagit/projects/1)
2. Create a new branch named `feature-[issue number]`

```bash
Expand All @@ -46,12 +46,12 @@ git push origin feature-[issue number]
```

6. [Create a Pull Request](https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) from your branch to develop
7. Move the Issue in the [project](https://github.com/UAlbanyArchives/mailbag/projects/1) to "Ready for Review"
7. Move the Issue in the [project](https://github.com/UAlbanyArchives/mailbagit/projects/1) to "Ready for Review"

## Reviewing

1. View the "Ready for Review" column in the [project](https://github.com/UAlbanyArchives/mailbag/projects/1) and identify the issue number
2. View the original [issue](https://github.com/UAlbanyArchives/mailbag/issues) and the [pull request](https://github.com/UAlbanyArchives/mailbag/pulls)
1. View the "Ready for Review" column in the [project](https://github.com/UAlbanyArchives/mailbagit/projects/1) and identify the issue number
2. View the original [issue](https://github.com/UAlbanyArchives/mailbagit/issues) and the [pull request](https://github.com/UAlbanyArchives/mailbagit/pulls)
3. Checkout the

```bash
Expand All @@ -74,4 +74,4 @@ git checkout develop
git merge feature-[issue number]
```

7. Move Move the Issue in the [project](https://github.com/UAlbanyArchives/mailbag/projects/1) to "Reviewer Approved"
7. Move Move the Issue in the [project](https://github.com/UAlbanyArchives/mailbagit/projects/1) to "Reviewer Approved"
Binary file modified data/eml-2016-06-23_144430_6e449c77fe/1/Headers.pickle
Binary file not shown.
Binary file modified data/eml-2016-06-23_144430_6e449c77fe/1/Message.pickle
Binary file not shown.
Binary file modified data/mbox-sample1/1/Headers.pickle
Binary file not shown.
Binary file modified data/mbox-sample1/1/Message.pickle
Binary file not shown.
2 changes: 1 addition & 1 deletion data/mbox-sample1/1/Subject.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
=?utf-8?Q?The_GOP=E2=80=99s_horrendous_damage?=
The GOP�s horrendous damage
Binary file modified data/mbox-sample1/2/Headers.pickle
Binary file not shown.
Binary file modified data/mbox-sample1/2/Message.pickle
Binary file not shown.
Binary file modified data/msg-Digitization Archiving Solutions/1/Headers.pickle
Binary file not shown.
Binary file modified data/pst-outlook2019_MSO_16.0.10377.20023_64-bit/1/Headers.pickle
Binary file not shown.
Binary file modified data/pst-outlook2019_MSO_16.0.10377.20023_64-bit/2/Headers.pickle
Binary file not shown.
20 changes: 10 additions & 10 deletions docs/installing_mailbagit/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ nav_order: 3

A docker image is available that includes all dependencies. You just need to install [Docker](https://docs.docker.com/get-docker/). Docker Desktop comes with everything you need, but you really only need Docker Engine.

Once Docker is installed, you can download the mailbag image with the command:
Once Docker is installed, you can download the mailbagit image with the command:

```
docker pull ualbanyarchives/mailbag
docker pull ualbanyarchives/mailbagit
```

To run the image as a Docker container, run:

```
docker run -it ualbanyarchives/mailbag
docker run -it ualbanyarchives/mailbagit
```

You should be able to run `mailbagit -h`, but you won't be able to do much without giving the container access to your filesystem.
Expand All @@ -32,8 +32,8 @@ Mailbagit will have access to the directory listed in the `source=` argument, wh

Examples:
```
docker run -it --mount type=bind,source="path/to/data",target=/data ualbanyarchives/mailbag:dev
docker run -it --mount type=bind,source="C:\Users\Me\path\to\data",target=/data ualbanyarchives/mailbag:dev
docker run -it --mount type=bind,source="path/to/data",target=/data ualbanyarchives/mailbagit:dev
docker run -it --mount type=bind,source="C:\Users\Me\path\to\data",target=/data ualbanyarchives/mailbagit:dev
```

If you are using Windows, the `source=` argument should be given a Windows path with "`\`", but the container uses Unix-style paths, so it will be accessible to `mailbagit` using `/data` using "`/`".
Expand All @@ -52,11 +52,11 @@ which will make the file accessible as `/data/sampleData/export.pst`

## Using Docker Desktop

Once you've downloaded the docker image with `docker pull ualbanyarchives/mailbag`, you can also run the image using [Docker Desktop](https://www.docker.com/products/docker-desktop/).
Once you've downloaded the docker image with `docker pull ualbanyarchives/mailbagit`, you can also run the image using [Docker Desktop](https://www.docker.com/products/docker-desktop/).

The ualbanyarchives/mailbag image should display. To run it, click "Run".
The ualbanyarchives/mailbagit image should display. To run it, click "Run".

![Screenshot of the ualbanyarchives/mailbag image available in Docker Desktop.]({{ site.baseurl }}/img/docker1.png)
![Screenshot of the ualbanyarchives/mailbagit image available in Docker Desktop.]({{ site.baseurl }}/img/docker1.png)

To give the container access to your filesystem, click on the optional settings and enter a "Host Path" and an "Container Path". [This follows the same rules as described above](#run-with-access-to-your-filesystem).

Expand All @@ -73,8 +73,8 @@ Remember to stop the container when your done!
There is also a development image available:

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

### Other helpful docker commands
Expand Down
20 changes: 10 additions & 10 deletions docs/installing_mailbagit/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Pip should come installed with Python on Windows. On Mac or Linux, you should al
When you have Python >3.7 and pip, to install `mailbagit`, just run:

```
pip install mailbag
pip install mailbagit
```

## Working with PST files

Packaging mailbags from PST files requires additional dependencies. To install these, in addition to `pip install mailbag`, you need to run:
Packaging mailbags from PST files requires additional dependencies. To install these, in addition to `pip install mailbagit`, you need to run:

```
pip install mailbag[pst]
pip install mailbagit[pst]
```

Installing this on Windows requires Visual Studio C++ Build Tools. Without this you will get an error. To rectify this:
Expand All @@ -41,40 +41,40 @@ Once the VS 2019 C++ x64/x86 build tools are installed, you can exit the Visual
You should now be able install the PST dependencies with:

```
pip install mailbag[pst]
pip install mailbagit[pst]
```

## Using the Mailbagit Graphical User Interface (GUI)

To install the mailbagit GUI, in addition to `pip install mailbag`, you need to run:
To install the mailbagit GUI, in addition to `pip install mailbagit`, you need to run:

```
pip install mailbag[gui]
pip install mailbagit[gui]
```

If it is installed correctly, the GUI will run using the `mailbagit-gui` command.

### Mailbagit GUI on Windows

There is a [known issue](https://github.com/UAlbanyArchives/mailbag/issues/155) where the GUI does not run with the `mailbagit-gui` command on Windows. It will boot and lets you enter options but then fails to run when you click "start."
There is a [known issue](https://github.com/UAlbanyArchives/mailbagit/issues/155) where the GUI does not run with the `mailbagit-gui` command on Windows. It will boot and lets you enter options but then fails to run when you click "start."

Instead, try creating a file called `mailbagit-gui.py` with the contents:

```
from mailbag import gui
from mailbagit import gui
gui()
```

You should then be able to run the GUI with `python3 mailbagit-gui.py`.

### Mailbagit GUI on Ubuntu

The GUI dependency wxPython does not install well on some environments, including Ubuntu. If `pip install mailbag[gui]` fails, you may want to try a [specific version for your distro](https://extras.wxpython.org/wxPython4/extras/linux/gtk3/).
The GUI dependency wxPython does not install well on some environments, including Ubuntu. If `pip install mailbagit[gui]` fails, you may want to try a [specific version for your distro](https://extras.wxpython.org/wxPython4/extras/linux/gtk3/).

For example, on Ubuntu 20.04, this seems to work well.

```
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
```

After wxPython is installed, try running `pip install mailbag[gui]` again.
After wxPython is installed, try running `pip install mailbagit[gui]` again.
2 changes: 1 addition & 1 deletion docs/using_mailbagit/concerns.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Automatically converting the HTML within emails to PDFs and WARCs can cause secu

These issues primarily apply when running wkhtmltopdf in a web application where a potentially malicious user has access to the PDFs that are generated. Using Google Chrome may mitigate a few of these vulnerabilities, but overall shares most of these risks. This also applies to WARC derivatives.

We don't suggest using `mailbagit` in a web application, as a malicious email may leak information about the computer used to used to process it into a PDF. Since Mailbag is designed for email preservation, in many contexts it may be unlikely for you to encounter malicious emails designed specifically to cause issues with `mailbagit`, but it is still helpful to be aware of this issue. Running `mailbagit` in a [Docker container](({{ site.baseurl}}/docker)) mitigates many of these concerns.
We don't suggest using `mailbagit` in a web application, as a malicious email may leak information about the computer used to used to process it into a PDF. Since `mailbagit` is designed for email preservation, in many contexts it may be unlikely for you to encounter malicious emails designed specifically to cause issues with `mailbagit`, but it is still helpful to be aware of this issue. Running `mailbagit` in a [Docker container](({{ site.baseurl}}/docker)) mitigates many of these concerns.

## Email Trackers

Expand Down
18 changes: 9 additions & 9 deletions docs/using_mailbagit/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ nav_order: 3

# Configuring Logging

* The level of logs displayed by Mailbag is based on an environment variable `MAILBAG_LOG_LEVEL`.
* The level of logs displayed by `mailbagit` is based on an environment variable `MAILBAGIT_LOG_LEVEL`.

* Log levels are available in the following order : `NOTSET`, `DEBUG`, `INFO`, `WARN`, `ERROR`, and `CRITICAL`.
For example, when the `MAILBAG_LOG_LEVEL` is `DEBUG`, `Mailbag` displays logs of all levels.
And when `MAILBAG_LOG_LEVEL` is `WARN`, it displays logs of level `WARN` and above. i.e. `WARN`, `ERROR`, or `CRITICAL`.
For example, when the `MAILBAGIT_LOG_LEVEL` is `DEBUG`, `mailbagit` displays logs of all levels.
And when `MAILBAGIT_LOG_LEVEL` is `WARN`, it displays logs of level `WARN` and above. i.e. `WARN`, `ERROR`, or `CRITICAL`.

* If no `MAILBAG_LOG_LEVEL` environment variable is set, mailbag will default to `WARN`.
* If no `MAILBAGIT_LOG_LEVEL` environment variable is set, `mailbagit` will default to `WARN`.

Unix example:

```
export MAILBAG_LOG_LEVEL=info
echo $MAILBAG_LOG_LEVEL
export MAILBAGIT_LOG_LEVEL=info
echo $MAILBAGIT_LOG_LEVEL
> info
```

Windows Powershell example:

```
$env:MAILBAG_LOG_LEVEL='debug'
$env:MAILBAG_LOG_LEVEL
$env:MAILBAGIT_LOG_LEVEL='debug'
$env:MAILBAGIT_LOG_LEVEL
> debug
```

Expand All @@ -40,7 +40,7 @@ On Windows, you can also [set environment variables by searching "edit environme

```
from structlog import get_logger
import mailbag.loggerx
import mailbagit.loggerx
loggerx.configure()
log = get_logger()
log.error("Error message here")
Expand Down
6 changes: 3 additions & 3 deletions docs/using_mailbagit/lossiness.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ nav_order: 5

* Some derivative formats, such as PDFs, do not have the structure to appropriately store all parts of a message.
* In other cases, such as PSTs and MSGs, dependency libraries do not provide complete access to all the technical characteristics of a message.
* `mailbagit` maintains what we feel are the meaningful characteristics of each message as defined by the `mailbagit` [email model](https://github.com/UAlbanyArchives/mailbag/blob/develop/mailbag/models.py).
* `mailbagit` maintains what we feel are the meaningful characteristics of each message as defined by the `mailbagit` [email model](https://github.com/UAlbanyArchives/mailbagit/blob/develop/mailbagit/models.py).
* Derivative EML or MBOX files created from PST or MSG source messages will contain all message headers, correctly encoded HTML and plain text bodies if present, and attachments.
* The part structure of a message is not maintained.
* Generating EMLs from an MBOX or the reverse writes the full Python email message object if possible, so this should be lossless and contain the full part structure of a message.
* For some MBOXs or EMLs with missing or inconsistently documented encoding, `mailbagit` tries to write the full message object. If it cannot, it writes a warning and falls back to writing derivatives from the [model](https://github.com/UAlbanyArchives/mailbag/blob/develop/mailbag/models.py).
* For some MBOXs or EMLs with missing or inconsistently documented encoding, `mailbagit` tries to write the full message object. If it cannot, it writes a warning and falls back to writing derivatives from the [model](https://github.com/UAlbanyArchives/mailbagit/blob/develop/mailbagit/models.py).

Mailbag's approach to keep messages in multiple formats is designed to mitigate these issues by maintaining the original source format alongside all derivatives.

However, if this does not fit your use case, please let us know by [submitting an issue](https://github.com/UAlbanyArchives/mailbag/issues)!
However, if this does not fit your use case, please let us know by [submitting an issue](https://github.com/UAlbanyArchives/mailbagit/issues)!
10 changes: 4 additions & 6 deletions docs/using_mailbagit/mailbagit-gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ nav_order: 2

# mailbagit-gui

Mailbag-it includes a very basic graphical user interface (GUI)
Mailbagit includes a very basic graphical user interface (GUI)

If `mailbagit` is [installed](http://localhost:4000/mailbag/python/) you should be able to run the GUI by entering the `mailbagit-gui` command. The mailbagit GUI is currently not supported while running in a docker container.
If `mailbagit` is [installed]({{ site.baseurl }}/python/) you should be able to run the GUI by entering the `mailbagit-gui` command. The mailbagit GUI is currently not supported while running in a docker container.

## Accessibility

Expand All @@ -22,14 +22,12 @@ Instead, we plan to implement a "guided" command line option, which we hope may

## Mailbagit GUI on Windows

There is a [known issue](https://github.com/UAlbanyArchives/mailbag/issues/155) where the GUI does not fully run on Windows using the `mailbagit-gui` command. It will boot and lets you enter options but then fails to run when you click "Start."

The GUI will run on Windows using the `mailbagit-gui.exe` [executable]({{ site.baseurl }}/exe).
There is a [known issue](https://github.com/UAlbanyArchives/mailbagit/issues/155) where the GUI does not fully run on Windows using the `mailbagit-gui` command. It will boot and lets you enter options but then fails to run when you click "Start."

If you are runnig it natively with python, you can also try creating a file called `mailbagit-gui.py` with the contents:

```
from mailbag import gui
from mailbagit import gui
gui()
```

Expand Down
Loading

0 comments on commit 51e9832

Please sign in to comment.