Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a80ceca118 | ||
|
|
f280c00f87 | ||
|
|
f831f935b9 | ||
|
|
222d3fad72 |
@@ -28,3 +28,12 @@
|
|||||||
|
|
||||||
# Optional: This will rewrite the from address overwriting it with the specified address for all email being relayed.
|
# Optional: This will rewrite the from address overwriting it with the specified address for all email being relayed.
|
||||||
#OVERWRITE_FROM="Your Name" <email@company.com>
|
#OVERWRITE_FROM="Your Name" <email@company.com>
|
||||||
|
|
||||||
|
# Optional: This will use allow you to set a custom $mydestination value. Default is localhost.
|
||||||
|
#DESTINATION=
|
||||||
|
|
||||||
|
# Optional: This will output the subject line of messages in the log.
|
||||||
|
#LOG_SUBJECT=yes
|
||||||
|
|
||||||
|
# Optional: This will disable (no) or enable (yes) the use of SMTPUTF8
|
||||||
|
#SMTPUTF8_ENABLE=no
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ The following env variable(s) are optional.
|
|||||||
OVERWRITE_FROM=email@company.com
|
OVERWRITE_FROM=email@company.com
|
||||||
OVERWRITE_FROM="Your Name" <email@company.com>
|
OVERWRITE_FROM="Your Name" <email@company.com>
|
||||||
|
|
||||||
|
* `DESTINATION` This will define a list of domains from which incoming messages will be accepted.
|
||||||
|
|
||||||
|
* `LOG_SUBJECT` This will output the subject line of messages in the log.
|
||||||
|
|
||||||
|
* `SMTPUTF8_ENABLE` This will enable (default) or disable support for SMTPUTF8. Valid values are `no` to disable and `yes` to enable. Not setting this variable will use the postfix default, which is `yes`.
|
||||||
|
|
||||||
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" \
|
||||||
|
|||||||
19
run.sh
19
run.sh
@@ -30,7 +30,7 @@ DOMAIN=`echo ${SERVER_HOSTNAME} | awk 'BEGIN{FS=OFS="."}{print $(NF-1),$NF}'`
|
|||||||
add_config_value "maillog_file" "/dev/stdout"
|
add_config_value "maillog_file" "/dev/stdout"
|
||||||
add_config_value "myhostname" ${SERVER_HOSTNAME}
|
add_config_value "myhostname" ${SERVER_HOSTNAME}
|
||||||
add_config_value "mydomain" ${DOMAIN}
|
add_config_value "mydomain" ${DOMAIN}
|
||||||
add_config_value "mydestination" 'localhost'
|
add_config_value "mydestination" "${DESTINATION:-localhost}"
|
||||||
add_config_value "myorigin" '$mydomain'
|
add_config_value "myorigin" '$mydomain'
|
||||||
add_config_value "relayhost" "[${SMTP_SERVER}]:${SMTP_PORT}"
|
add_config_value "relayhost" "[${SMTP_SERVER}]:${SMTP_PORT}"
|
||||||
add_config_value "smtp_use_tls" "yes"
|
add_config_value "smtp_use_tls" "yes"
|
||||||
@@ -61,11 +61,18 @@ fi
|
|||||||
|
|
||||||
#Set header tag
|
#Set header tag
|
||||||
if [ ! -z "${SMTP_HEADER_TAG}" ]; then
|
if [ ! -z "${SMTP_HEADER_TAG}" ]; then
|
||||||
postconf -e "header_checks = regexp:/etc/postfix/header_tag"
|
postconf -e "header_checks = regexp:/etc/postfix/header_checks"
|
||||||
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 -e "/^MIME-Version:/i PREPEND RelayTag: $SMTP_HEADER_TAG\n/^Content-Transfer-Encoding:/i PREPEND RelayTag: $SMTP_HEADER_TAG" >> /etc/postfix/header_checks
|
||||||
echo "Setting configuration option SMTP_HEADER_TAG with value: ${SMTP_HEADER_TAG}"
|
echo "Setting configuration option SMTP_HEADER_TAG with value: ${SMTP_HEADER_TAG}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#Enable logging of subject line
|
||||||
|
if [ "${LOG_SUBJECT}" == "yes" ]; then
|
||||||
|
postconf -e "header_checks = regexp:/etc/postfix/header_checks"
|
||||||
|
echo -e "/^Subject:/ WARN" >> /etc/postfix/header_checks
|
||||||
|
echo "Enabling logging of subject line"
|
||||||
|
fi
|
||||||
|
|
||||||
#Check for subnet restrictions
|
#Check for subnet restrictions
|
||||||
nets='10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16'
|
nets='10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16'
|
||||||
if [ ! -z "${SMTP_NETWORKS}" ]; then
|
if [ ! -z "${SMTP_NETWORKS}" ]; then
|
||||||
@@ -79,6 +86,12 @@ if [ ! -z "${SMTP_NETWORKS}" ]; then
|
|||||||
fi
|
fi
|
||||||
add_config_value "mynetworks" "${nets}"
|
add_config_value "mynetworks" "${nets}"
|
||||||
|
|
||||||
|
# Set SMTPUTF8
|
||||||
|
if [ ! -z "${SMTPUTF8_ENABLE}" ]; then
|
||||||
|
postconf -e "smtputf8_enable = ${SMTPUTF8_ENABLE}"
|
||||||
|
echo "Setting configuration option smtputf8_enable with value: ${SMTPUTF8_ENABLE}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -z "${OVERWRITE_FROM}" ]; then
|
if [ ! -z "${OVERWRITE_FROM}" ]; then
|
||||||
echo -e "/^From:.*$/ REPLACE From: $OVERWRITE_FROM" > /etc/postfix/smtp_header_checks
|
echo -e "/^From:.*$/ REPLACE From: $OVERWRITE_FROM" > /etc/postfix/smtp_header_checks
|
||||||
postmap /etc/postfix/smtp_header_checks
|
postmap /etc/postfix/smtp_header_checks
|
||||||
|
|||||||
Reference in New Issue
Block a user