Files
structured-website-builder-…/skills-scripts/contact-form-deployment.md
T

43 lines
1.1 KiB
Markdown
Raw Normal View History

2026-06-06 06:37:41 -06:00
# Contact Form Deployment
The website form posts to `/api/contact`. The handler is a small FastAPI app in
`api/contact_app.py` and sends mail through SMTP provider.
## VM Packages
Install Python and the contact API dependencies inside the container or Python
runtime that will serve the API:
```bash
python3 -m pip install -r requirements-contact-api.txt
```
The runtime needs these environment variables. Do not commit their values:
```bash
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=<smtp-user>
SMTP_PASSWORD=<smtp-password>
CONTACT_TO_EMAIL=<where messages should go>
CONTACT_FROM_EMAIL=<verified SMTP sender address>
```
## Run Command
Run the API on an internal port, then route `/api/contact` to it from the
existing container/Caddy setup:
```bash
uvicorn api.contact_app:app --host 0.0.0.0 --port 8091
```
Health check:
```bash
curl http://localhost:8091/api/contact/healthz
```
The public static site can continue to be served as it is now. The only
deployment requirement is that requests for `/api/contact` and
`/api/contact/healthz` reach the FastAPI process.