Files

41 lines
1.2 KiB
Markdown

# MailThisForMe TUI
A dependency-free Go terminal app for quoting and sending Letter-size PDF documents through the MailThisForMe API.
## Run
```sh
go run .
```
Or build a reusable binary:
```sh
go build -o mtfm-mailer .
./mtfm-mailer
```
Preselect a document at launch:
```sh
./mtfm-mailer -f=./file.pdf
```
The app reads `MAILTHISFORME_API_KEY` from `.env` or the process environment. Optional environment variables:
- `MAILTHISFORME_BASE_URL` or `MTFM_BASE_URL`, defaulting to `https://api.mailthisforme.com`
- `MTFM_HTTP_TIMEOUT`, defaulting to `60s`
## What It Does
- Selects a local PDF with a navigable terminal file list and estimates its page count.
- Checks selected PDFs for US Letter page dimensions before sending.
- Converts the selected PDF to US Letter with Ghostscript when `gs` is available.
- Gets a quote from `POST /v1/mail/quote`.
- Sends the PDF with recipient fields to `POST /v1/mail/send`.
- Supports default return address, a saved return address id, or direct sender fields.
- Lists saved return addresses from `GET /v1/return-addresses`.
- Checks balance and mail job status.
MailThisForMe preview constraints still apply: PDFs must be US Letter, 10 MB or smaller, and no more than 10 pages.