# Install the app
go install github.com/p-tupe/code-examples/go/mail-server
# Pull .env.sample
curl -fsSL -o .env \
https://raw.githubusercontent.com/p-tupe/code-examples/refs/heads/main/go/mail-server/.env.sample
# Modify the variables
$EDITOR .env
# Pull the service file
curl -fsSL -o go-mail-server.service \
https://raw.githubusercontent.com/p-tupe/code-examples/refs/heads/main/go/mail-server/go-mail-server.service
# Modify the exec path and environ file var
$EDITOR go-mail-server.service
# Copy service file to systemd dir
sudo cp mail-server.service /etc/systemd/system/
# Enable on login and start immediately
sudo systemctl daemon-reload
sudo systemctl enable --now go-mail-server
# Check logs to ensure it is running
sudo journalctl -u go-mail-server
This is a simple mail server implementation that accepts an email body content on POST /
in form of a custom (To,Subject,Message) json body or simple plain text,
and sends it over via SMTP using go's builtin net/smtp(https://pkg.go.dev/net/smtp) package.