From e0d3ab0af75f6871e07e2060619d73d467539514 Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Mon, 24 Aug 2020 21:41:08 +0200 Subject: [PATCH] Add option always_add_missing_headers (#32) (adding From:, To:, Date: or Message-ID: headers when not present, cf. http://www.postfix.org/postconf.5.html#always_add_missing_headers) This option always_add_missing_headers is set by the environment variable ALWAYS_ADD_MISSING_HEADERS (default: no) --- .env.example | 5 ++++- README.md | 1 + run.sh | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index a711c0a..cda261d 100644 --- a/.env.example +++ b/.env.example @@ -21,4 +21,7 @@ #SMTP_NETWORKS= # Optional: Set this to a mounted file containing the password, to avoid passwords in env variables. -#SMTP_PASSWORD_FILE= \ No newline at end of file +#SMTP_PASSWORD_FILE= + +# Optional: Set this to yes to always add missing From:, To:, Date: or Message-ID: headers. +#ALWAYS_ADD_MISSING_HEADERS=yes diff --git a/README.md b/README.md index ef043b1..822dfdc 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ The following env variable(s) are optional. * `SMTP_PASSWORD_FILE` Setting this to a mounted file containing the password, to avoid passwords in env variables. Used like -e SMTP_PASSWORD_FILE=/secrets/smtp_password -v $(pwd)/secrets/:/secrets/ +* `ALWAYS_ADD_MISSING_HEADERS` This is related to the [always\_add\_missing\_headers](http://www.postfix.org/postconf.5.html#always_add_missing_headers) Postfix option (default: `no`). If set to `yes`, Postfix will always add missing headers among `From:`, `To:`, `Date:` or `Message-ID:`. 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: diff --git a/run.sh b/run.sh index 976cc66..4fd4cc9 100644 --- a/run.sh +++ b/run.sh @@ -36,6 +36,7 @@ add_config_value "smtp_use_tls" "yes" add_config_value "smtp_sasl_auth_enable" "yes" add_config_value "smtp_sasl_password_maps" "hash:/etc/postfix/sasl_passwd" add_config_value "smtp_sasl_security_options" "noanonymous" +add_config_value "always_add_missing_headers" "${ALWAYS_ADD_MISSING_HEADERS:-no}" # Create sasl_passwd file with auth credentials if [ ! -f /etc/postfix/sasl_passwd ]; then