Fixed conflict

This commit is contained in:
Juan Luis Baptiste 2019-03-06 21:26:30 -05:00
commit 8fe92a8fe5
2 changed files with 11 additions and 3 deletions

View File

@ -33,6 +33,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 or the one specified by `SMTP_PORT` needs to be exposed to the docker host server: To use this container from anywhere, the 25 port or the one specified by `SMTP_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" \

11
run.sh
View File

@ -10,9 +10,7 @@ function add_config_value() {
[ "${value}" == "" ] && echo "ERROR: No value set !!" && exit 1 [ "${value}" == "" ] && echo "ERROR: No value set !!" && exit 1
echo "Setting configuration option ${key} with value: ${value}" echo "Setting configuration option ${key} with value: ${value}"
sed -i -e "/^#\?\(\s*${key}\s*=\s*\).*/{s//\1${value}/;:a;n;:ba;q}" \ postconf -e "${key} = ${value}"
-e "\$a${key}=${value}" \
${config_file}
} }
[ -z "${SMTP_SERVER}" ] && echo "SMTP_SERVER is not set" && exit 1 [ -z "${SMTP_SERVER}" ] && echo "SMTP_SERVER is not set" && exit 1
@ -46,5 +44,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