#!/bin/sh set -e # Generate main.cf from template with environment variables envsubst < /etc/postfix/main.cf.template > /etc/postfix/main.cf # Generate SASL password file from environment variables envsubst < /etc/postfix/sasl_passwd.template > /etc/postfix/sasl_passwd # Generate Postfix hash postmap /etc/postfix/sasl_passwd chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db # Start Postfix in foreground exec postfix start-fg