# ODK Mailer

A simple CLI to send Mails for ODK.
Built with Typer and packaged with Poetry.

## Requirements
- Python 3
- PIP

## Setup
**Install the cli via pip**
```bash
pip install odk-mailer
```

**Configuration example**
Config location: `~/.env`:
```
    SMTP_HOST=smtp.freesmtpservers.com
    SMTP_PORT=25
    SMTP_USER=
    SMTP_PASS=
    ODK_HOST=https://your.odk-central.host.tld
```

## Usage
**Create and run a new mail job**
```bash
    # Create a new mail job with a unique ID
    odk-mailer create

    # Run the job by ID
    odk-mailer run <job-id>
```

**List mail jobs and evaluate them**
```bash
    # Show all jobs
    odk-mailer list

    # Run all jobs that are ready to be sent
    odk-mailer evaluate
```

## Development
Building a Package - Guide: https://typer.tiangolo.com/tutorial/package/#create-your-app

**Requirements**
- Python 3.10
- Poetry 1.7

```bash
    # clone the repo and cd into
    poetry shell
    poetry install
    # Run it with
    poetry run odk-mailer 
```

**Push to PyPi**

```
    poetry build
    poetry publish
    # requires credentials to be setup: poetry config pypi-token.pypi <my-token>
```