A SMTP relay host for transactional based emails from within a k8 cluster.
This repository contains Kubernetes config files and a docker image to easily set up a SMTP relay for services such as SendGrid.
We needed a simple docker image that can be configured with env vars. Also, the functionality is easily overridded by providing an alternate init script.
Run on docker
docker run --rm -it -p 2525:25 \
-e TX_SMTP_RELAY_HOST="smtp.sendgrid.net" \
-e TX_SMTP_RELAY_PORT=25 \
-e TX_SMTP_RELAY_MYHOSTNAME=tx-smtp-relay.yourhost.com \
-e TX_SMTP_RELAY_USERNAME=username \
-e TX_SMTP_RELAY_PASSWORD=password \
applariat/tx-smtp-relay
Note that all parameters except TX_SMTP_RELAY_PORT are required. The default value for the port is 25.
Send a test message
telnet localhost 2525 220 tx-smtp-relay.yourhost.com ESMTP Postfix helo localhost 250 tx-smtp-relay.yourhost.com mail from: [email protected] 250 2.1.0 Ok rcpt to: [email protected] 250 2.1.5 Ok data 354 End data with . Subject: What? My hovercraft is full of eels. . 250 2.0.0 Ok: queued as 982FF53C quit 221 2.0.0 Bye Connection closed by foreign host