diff --git a/README.md b/README.md index d6ca131..5e0ae1d 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,9 @@ The following env variables need to be passed to the container: * `SMTP_PASSWORD` Password of the SMTP user. * `SERVER_HOSTNAME` Server hostname for the Postfix container. Emails will appear to come from the hostname's domain. +The following env variable(s) are optional. +* `SMTP_HEADER_TAG` This will add a header for tracking messages upstream. Helpful for spam filters. Will appear as "RelayTag: ${SMTP_HEADER_TAG}" in the email headers. + To use this container from anywhere, the 25 port needs to be exposed to the docker host server: docker run -d --name postfix -p "25:25" \ diff --git a/run.sh b/run.sh index aa1ff7d..49daade 100644 --- a/run.sh +++ b/run.sh @@ -46,5 +46,12 @@ if [ ! -f /etc/postfix/sasl_passwd ]; then fi fi +#Set header tag +if [ ! -z "${SMTP_HEADER_TAG}" ]; then + postconf -e "header_checks = regexp:/etc/postfix/header_tag" + echo -e "/^MIME-Version:/i PREPEND RelayTag: $SMTP_HEADER_TAG\n/^Content-Transfer-Encoding:/i PREPEND RelayTag: $SMTP_HEADER_TAG" > /etc/postfix/header_tag + echo "Setting configuration option SMTP_HEADER_TAG with value: ${SMTP_HEADER_TAG}" +fi + #Start services supervisord