/postfix-relay

Quick container image to run postfix as a relay

Primary LanguageShellMIT LicenseMIT

postfix-relay

A SMTP relay host for transactional based emails from within a k8 cluster.

Has amd64 and arm64 images.

Overview

This repository contains Kubernetes config files and a docker image to easily set up a SMTP relay for services such as SendGrid.

Background

I needed to send emails from my local network (e.g. multi-function printer) so wanted a simply relay to sit in front of Gsuite.

Modified from original https://github.com/applariat/kubernetes-postfix-relay-host

Quickstart

Run on docker

docker build -t smtp .
docker run --rm -it -p 2525:25 \
	-e TX_SMTP_RELAY_HOST="[smtp.sendgrid.net]:587" \
	-e TX_SMTP_RELAY_MYHOSTNAME=tx-smtp-relay.yourhost.com \
	-e TX_SMTP_RELAY_USERNAME=username \
	-e TX_SMTP_RELAY_PASSWORD=password \
	smtp

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: noreply@yourhost.com
250 2.1.0 Ok
rcpt to: chris@applariat.com
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