mailman3_webhook_archiver/README.md

67 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2023-05-19 18:54:45 +00:00
# Mailman3 webhook archiver
[![GitHub](https://img.shields.io/github/license/Laurent2916/mailman3_webhook_archiver)](https://github.com/Laurent2916/mailman3_webhook_archiver/blob/master/LICENSE)
2023-05-19 18:54:45 +00:00
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
A simple mailman3 archiver to notify a webhook of mails.
2023-05-19 18:54:45 +00:00
## Installation
2023-05-19 18:38:48 +00:00
A mailman archiver is a simple python package, to install it you can either use pip or install it manually.
2023-05-19 19:02:37 +00:00
If your use-case doesn't fit this archiver feel free to fork this project, create an issue or a pull request.
2023-05-19 18:38:48 +00:00
2023-05-19 18:54:45 +00:00
### Install using pip (recommended)
2023-05-19 18:38:48 +00:00
Activate the python environment used by mailman.
Install the package using pip:
```bash
pip install git+https://github.com/Laurent2916/mailman3_webhook_archiver.git
```
2023-05-19 18:54:45 +00:00
### Install manually (not recommended)
2023-05-19 18:38:48 +00:00
Clone the repository:
```bash
git clone https://github.com/Laurent2916/mailman3_webhook_archiver.git
cd mailman3_webhook_archiver
```
Copy the `mailman3_webhook_archiver` folder into your environment libraries.
The process may look something like one of the following lines:
```bash
cp -r mailman3_webhook_archiver /usr/lib/python3/dist-packages/
cp -r mailman3_webhook_archiver /path/to/.venv/lib/python3.11/site-packages/
```
2023-05-19 18:54:45 +00:00
## Configuration
2023-05-19 18:38:48 +00:00
The archiver loads its configuration using an external configuration file.
Create and fill `/etc/mailman3/mailman-webhook-archiver.cfg` with the relevant informations.
```ini
2023-05-19 18:38:48 +00:00
[global]
url = https://webhook.example.com/foo/bar
key = SUPER_SECRET_TOKEN_KEY
filter_spam = false
monitored_lists = my_mailing_list, another_list, foo, bar, test
```
Modify the mailman configuration to enable the newly added archiver.
Append the following to `/etc/mailman3/mailman.cfg`.
```ini
2023-05-19 18:38:48 +00:00
[archiver.mailman3_webhook_archiver]
class: mailman3_webhook_archiver.WebhookArchiver
configuration: /etc/mailman3/mailman3_webhook_archiver.cfg
enable: yes
```
2023-05-19 18:54:45 +00:00
## Special thanks
2023-05-19 18:38:48 +00:00
- https://gitlab.com/mailman/mailman/blob/master/src/mailman/archiving/prototype.py
- https://github.com/nim65s/matrix-webhook/