No description
  • JavaScript 77.2%
  • Dockerfile 12%
  • Just 10.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-14 14:05:25 +02:00
.dockerignore ci: add dockerfile 2026-10-14 14:04:08 +02:00
.gitignore initial commit 2024-02-05 23:41:09 +01:00
docker-compose.yml ci: add dockerfile 2026-10-14 14:04:08 +02:00
Dockerfile ci: add dockerfile 2026-10-14 14:04:08 +02:00
index.js feat: add status end point, tests smtp config 2026-10-14 14:03:51 +02:00
justfile ci: add dockerfile 2026-10-14 14:04:08 +02:00
package-lock.json chore: bump version to 0.1.0 2026-10-14 14:05:25 +02:00
package.json chore: bump version to 0.1.0 2026-10-14 14:05:25 +02:00
README.md ci: add dockerfile 2026-10-14 14:04:08 +02:00
VERSION chore: bump version to 0.1.0 2026-10-14 14:05:25 +02:00

Express Mailer

Node app accepting POST requests and sending the data as email.

Most basic node app for that that you could imagine.

Using express.js and nodemailer.

Options set via .env file:

APIKEY=xxx
PORT=3000
CORS=https://mydomain.com http://localhost:3000
MAILPASS="xxx"
MAILUSER=my@mail.address
MAILPORT=465
MAILSERVER=smtp.mail.server
SENDTO=receiving@email.adress
MESSAGE_TEMPLATE="replaces #var# with json body.var"
SUBJECT_TEMPLATE="replaces #var# with json body.var"
MESSAGE_TEMPLATE_VAR="if you want multiple templates, send a body.template = \"VAR\" variable"
SUBJECT_TEMPLATE_VAR="if you want multiple templates, send a body.template = \"VAR\" variable"

If no SUBJECT_TEMPLATE is given defaults to Kontaktformular von #name# if name is in body, or just Kontaktformular. If no MESSAGE_TEMPLATE is given, defaults to enumerating all body vars in the form of

var1: value1
var2: value2
...

Send Messages

How to send messages

Send a POST request to {example.tld}/contactformsubmit with a JSON body, containing either:

Template var

if body.template is set, MESSAGE_TEMPLATE_${body.template} will be used as a template and all variables in the body will be replaced in the template

Send message and subject

if body.message and body.subject are set, they are used without any altering as message body and subject

Singleton template [DEPRECATED]

you can send an object in body.singletontemplate containing a subject and body template in the same form as the env var templates

Send confirmation

if body.confirmation is set to either a string containing an email address or an object containing email, message, subject.

Deploy

Docker

Images are built for linux/amd64 and tagged :latest and :<VERSION>; the registry is set via image in the justfile. Log in to the registry once with docker login <registry>.

just build    # build the image locally
just push     # build and push the image
just release  # bump VERSION (commit + tag), then ask to build and push

Run it with the .env file:

docker run -d --env-file .env -p 8080:8080 <image>:latest

Uberspace

uberspace web backend set /contactformsubmit --http --port PORT
git clone git@github.com:marcelbusch/contactformforwarder.git
cd contactformforwarder
npm install

vim ~/etc/services.d/contactformforwarder.ini
# ~/etc/services.d/contactformforwarder.ini
[program:contactformforwarder]
directory=PATHTO/contactformforwarder
command=npm run start
autostart=true
autorestart=true
environment=NODE_ENV=production
$ supervisorctl restart contactformforwarder