Deploys a lightweight Postfix mail relay based on mwader/postfix-relay. It accepts unauthenticated local emails on port 25, rewrites all sender addresses to a defined address, and securely relays the emails to an upstream SMTP provider.
- Accepts unqualified senders and all recipients from internal networks.
- Accepts SMTP requests without TLS and authentication.
- Optionally accepts inbound TLS requests (generates a self-signed certificate on startup).
- Relays outbound emails via authenticated SMTP over TLS.
- Rewrites envelope senders and
From:headers dynamically based on.envconfiguration.
- A working Docker host.
- Port 25 must be available. On Debian hosts, disable the default MTA:
sudo systemctl stop exim4 sudo systemctl disable exim4
- Prepare the deployment directory:
sudo mkdir -p /opt/mailrelay sudo chown $USER:$USER /opt/mailrelay cd /opt/mailrelay git clone git@github.com:sdrwtf-labs/mailrelay-deployment.git .
- Make the wrapper script executable:
chmod +x wrapper.sh
- Configure the environment variables:
cp .env.example .env nano .env
- Start the service:
docker compose up -d
This repository is configured for automated deployments via GitHub Actions. Pushes to the main branch will trigger an SSH action to pull the latest code and recreate the container.
Ensure the SSH_PRIVATE_KEY secret is configured in the repository settings.