Metadata-Version: 2.4
Name: tudelft-email-sender
Version: 1.0.1
Summary: Script to send emails from a TU Delft account.
Project-URL: Homepage, https://gitlab.ewi.tudelft.nl/reit/email-sender
Author-email: Gara Dorta <g.dorta@tudelft.nl>
License-File: LICENSE
Requires-Python: >=3.14
Requires-Dist: python-dotenv>=1.1.1
Requires-Dist: typer>=0.26.7
Description-Content-Type: text/markdown

# TU Delft email-sender

[![PyPI](https://img.shields.io/pypi/v/tudelft-email-sender?logo=pypi&logoColor=%23959DA5)](https://pypi.org/project/tudelft-email-sender/)

Script to send emails from a TU Delft account.

## Instructions

1. In TopDesk, ask for a service/application account for the mailbox you want to send from.
This can be a functional mailbox.
2. Create a venv and install the package:
    ```bash
    pip install tudelft-email-sender
    ```
3. Download the .env file example [.env.example](https://gitlab.ewi.tudelft.nl/reit/email-sender/-/blob/main/.env.example):
    ```bash
    curl -L https://gitlab.ewi.tudelft.nl/reit/email-sender/-/raw/main/.env.example -o .env
    ```
4. Edit the `.env` and set your SMTP credentials:
    ```dotenv
    FROM_ADDRESS=email@tudelft.nl
    SMTP_USER=_sa-email-smtpa
    SMTP_PASSWORD=password
    ```
6. Send an email like so:
    ```bash
    send-email \
      --from myservice-account@tudelft.nl \
      --recipients alice@example.com \
      --recipients bob@example.com \
      --subject "Test email" \
      --body "Hello, this is a test email." \
      --attachments ./docs/example.pdf
    ```

Notes:
- Repeat `--recipients`, `--cc`, `--bcc`, and `--attachments` to pass multiple values.
- Check all available CLI options:
    ```bash
    send-email --help
    ```
## Develop

2. Clone the repo and install dependencies:
    ```bash
    uv sync
    ```
3. Create your local environment file from the example [.env.example](https://gitlab.ewi.tudelft.nl/reit/email-sender/-/blob/main/.env.example):
    ```bash
    cp .env.example .env
    ```
6. Send an email like so:
    ```bash
    uv run send-email \
      --from myservice-account@tudelft.nl \
      --recipients alice@example.com \
      --recipients bob@example.com \
      --subject "Test email" \
      --body "Hello, this is a test email." \
      --attachments ./docs/example.pdf
    ```
7. A launch.json is provided for easy debugging with vscode.

## License
Distributed under the terms of the [GPL license](LICENSE).
