Merge pull request #9 from turboaaa/patch-3

Create tag for optional upstream tracking.
This commit is contained in:
Juan Luis Baptiste 2019-01-27 00:05:11 -05:00 committed by GitHub
commit 92b283d6d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -31,6 +31,9 @@ The following env variables need to be passed to the container:
* `SMTP_PASSWORD` Password of the SMTP user. * `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. * `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: 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" \ docker run -d --name postfix -p "25:25" \

7
run.sh
View File

@ -46,5 +46,12 @@ if [ ! -f /etc/postfix/sasl_passwd ]; then
fi fi
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 #Start services
supervisord supervisord