SMTP Relay
SMTP Relay is a very simple SMTP server that will relay all incoming emails to a remote mail service.
I use as a single entrypoint to relay all mails from my Docker containers to Mailgun.
Usage (Docker)
Docker-compose
The easiest way to run SMTP Relay is with docker-compose.
Edit the .env
file with your settings, download the docker-compose.yml file and run it with:
docker-compose up -d
Docker run
If you don't want to use Docker compose, you can always run the command manually:
docker run -it\
-e REMOTE_SMTP_HOST=${REMOTE_SMTP_HOST} \
-e REMOTE_SMTP_PORT=${REMOTE_SMTP_PORT} \
-e REMOTE_SMTP_DISABLE_TLS=${REMOTE_SMTP_DISABLE_TLS} \
-e REMOTE_SMTP_USER=${REMOTE_SMTP_USER} \
-e REMOTE_SMTP_PASSWORD=${REMOTE_SMTP_PASSWORD} \
-p 25:25 \
denbeke/smtprelay
Usage (binary)
Download the latest SMTP Relay from the releases page.
Configure your settings in the .env
and run the SMTP Relay with:
./smtprelay
Development
Run it manually with Go (requires Go 1.15 or newer):
go run cmd/smtprelay/*.go
To test the email functionality, you can send the test.txt
SMTP mail with a tool like netcat:
nc localhost 25 -i 1 < mail.txt
Acknowledgments
Author
Mathias Beke