Support for setting relayhost in main.cf (#1104)

* Added DEFAULT_RELAY_HOST setting
* If set this value will be used as the relayhost in /etc/postfix/maincf causing all mail to be delivered using this relay host
* Test for default relay host setting
This commit is contained in:
jjtt 2019-01-19 12:10:31 +02:00 committed by Johan Smits
parent 1302ccfe7e
commit a3724fa91d
6 changed files with 49 additions and 1 deletions

View file

@ -145,6 +145,10 @@ function register_functions() {
_register_setup_function "_setup_postfix_relay_hosts"
fi
if [ ! -z "$DEFAULT_RELAY_HOST" ]; then
_register_setup_function "_setup_postfix_default_relay_host"
fi
if [ ! -z "$RELAY_HOST" ]; then
_register_setup_function "_setup_postfix_relay_hosts"
fi
@ -1066,6 +1070,13 @@ function _setup_postfix_sasl_password() {
fi
}
function _setup_postfix_default_relay_host() {
notify 'task' 'Applying default relay host to Postfix'
notify 'inf' "Applying default relay host $DEFAULT_RELAY_HOST to /etc/postfix/main.cf"
postconf -e "relayhost = $DEFAULT_RELAY_HOST"
}
function _setup_postfix_relay_hosts() {
notify 'task' 'Setting up Postfix Relay Hosts'
# copy old AWS_SES variables to new variables