Skip to content

About

Sends a confirmation e-mail for every new LamaPoll signup. Unofficial, not affiliated with LamaPoll.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

lamamailer (Node.js / TypeScript)

Sends an automatic confirmation e-mail for every new LamaPoll signup. LamaPoll has no webhooks, so the service polls the legacyResults export, queues new submissions in SQLite and sends them over your SMTP server.

Everything is configured in the admin UI. The only thing you type is the LamaPoll API key; then you add one or more polls (forms) from a list and pick each form's e-mail field (and optional first/last name) from its questions. Every form sends a mail template of your choice (or the default one) and is started and paused on its own. SMTP, sending rules and queue management are in the UI too.

One submission = one mail. The same address signing up twice gets two mails (capped by "Mails pro Adresse und Stunde").

Disclaimer: This is an independent, unofficial project. It is not affiliated with, endorsed, sponsored or supported by LamaPoll or its operator. "LamaPoll" is used only to describe what this tool works with; the name and trademark belong to their respective owner. The software is provided as is, without warranty. You are responsible for using the LamaPoll API within its terms and for sending mail in line with applicable law (e.g. GDPR).

Run it

Requires Node.js 24+. The TypeScript sources are compiled with tsc to dist/.

npm ci && npm run build
HOST=127.0.0.1 PORT=3000 DATA_DIR=./data npm start

On the first start the log prints a Setup-Code. Open the address, enter the code and choose the admin password. Then follow the pages: Einstellungen (1 LamaPoll API key, 2 SMTP, 3 sending rules), Formulare (add forms, pick fields and mail template), Mail-Texte, then Übersicht → Starten for each form.

Updating from 1.1: the configured poll becomes the first form with its signups, fields and state; its mail text becomes the default template.

The only environment variables are HOST (default 127.0.0.1), PORT (default 3000) and DATA_DIR (default ./data). The SQLite file in DATA_DIR holds the API key and SMTP password (file mode 600, directory mode 700): back it up nightly, keep it private.

Production (Linux VPS)

sudo useradd --system --home /var/lib/lamamailer lamamailer
npm ci && npm run build   # in your checkout
sudo mkdir -p /opt/lamamailer && sudo cp -r dist package.json package-lock.json /opt/lamamailer/
cd /opt/lamamailer && sudo npm ci --omit=dev
sudo cp deploy/lamamailer.service /etc/systemd/system/ && sudo systemctl enable --now lamamailer
journalctl -u lamamailer | grep Setup-Code

Docker (alternative)

docker build -t lamamailer .
docker run -d --name lamamailer --restart unless-stopped \
  -p 127.0.0.1:3000:3000 -v lamamailer-data:/data lamamailer
docker logs lamamailer | grep Setup-Code

Inside the container HOST=0.0.0.0 and DATA_DIR=/data. Publish the port only on 127.0.0.1 and keep the proxy in front. The volume holds the secrets, so back it up.

Put Caddy in front for HTTPS (deploy/Caddyfile) and allow only ports 22, 80 and 443. Behind a proxy the session cookie automatically gets the Secure flag (via X-Forwarded-Proto). Set SPF, DKIM and DMARC for the sender domain: that matters more for deliverability than anything in this code.

Mail templates

Mail texts are kept as named templates under Mail-Texte. One is the default; every form sends the default unless you pick another template for it under Formulare, and several forms can share one template. Changing the default template changes every form that has no own choice.

Texts are written in a visual editor (TipTap): bold, headings, lists, links, and buttons that insert personal details as named chips. Every mail gets the same frame (width, font), so a text only holds its content. Under the hood a template is HTML with placeholders: {name} {first_name} {last_name} {email} {site_url} {answers} (table of all answers, decoded to readable labels) and {field:V60} (one answer by variable name); "HTML bearbeiten" shows it. The page has a preview (sandboxed), a warning for unknown placeholders (e.g. a typo like {frist_name}), and "Test-Mail senden".

Everything except Einstellungen is written for non-technical users; the settings page is for the admin.

How it behaves

  • First start: signups that already exist when you click Starten for a form are not mailed (your choice in the UI).
  • Polling: every started form every 20 s (configurable) with a date-only dateFrom one day back (switchable to date and time); known submissions are ignored by their vID (per form). A form whose polls fail backs off up to 5 minutes without slowing the others; the error shows up on its dashboard card.
  • Removing a form deletes its signups; adding it again starts from scratch.
  • Restart safe: a row is marked sending before the SMTP call. If the server dies mid-send, that row is not resent automatically; the dashboard flags it and you choose "Bestätigen" (it was delivered) or "Erneut".
  • Security: setup code on first start, scrypt password hashes, HttpOnly + SameSite=Strict session cookie, cross-site POSTs refused, HTML-escaped output, sandboxed template preview.

Development

npm run build       # tsc -> dist/ (server + browser script), copies templates/CSS
npm test            # builds, then runs node:test on dist/test; no network needed
npm run typecheck   # tsc --noEmit for server and browser code

See AGENTS.md for the workflow rules.

About

Sends a confirmation e-mail for every new LamaPoll signup. Unofficial, not affiliated with LamaPoll.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages