From ceab4779d9ac31bc5328410637b61f692925b502 Mon Sep 17 00:00:00 2001 From: Nasser <2208840+nassoor@users.noreply.github.com> Date: Tue, 21 Jun 2022 00:38:09 +0300 Subject: [PATCH] feat: Add message_size_limit option (#86) * feat: Add MESSAGE_SIZE_LIMIT configuration option (PR #86) --- .env.example | 3 +++ README.md | 2 ++ run.sh | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/.env.example b/.env.example index 0099c2b..ea1d35c 100644 --- a/.env.example +++ b/.env.example @@ -37,3 +37,6 @@ # Optional: This will disable (no) or enable (yes) the use of SMTPUTF8 #SMTPUTF8_ENABLE=no + +# Optional: This will use allow you to set a custom $message_size_limit value. Default is 10240000. +#MESSAGE_SIZE_LIMIT= diff --git a/README.md b/README.md index bb12228..dbab175 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,8 @@ The following env variable(s) are optional. * `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`. +* `MESSAGE_SIZE_LIMIT` This will change the default limit of 10240000 bytes (10MB). + 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" \ diff --git a/run.sh b/run.sh index a731e8b..6f540ca 100644 --- a/run.sh +++ b/run.sh @@ -99,6 +99,12 @@ if [ ! -z "${OVERWRITE_FROM}" ]; then echo "Setting configuration option OVERWRITE_FROM with value: ${OVERWRITE_FROM}" fi +# Set message_size_limit +if [ ! -z "${MESSAGE_SIZE_LIMIT}" ]; then + postconf -e "message_size_limit = ${MESSAGE_SIZE_LIMIT}" + echo "Setting configuration option message_size_limit with value: ${MESSAGE_SIZE_LIMIT}" +fi + #Start services # If host mounting /var/spool/postfix, we need to delete old pid file before