The following script helps the admin to activate a relayhost in postfix configuration. It asks the user for the values on command line and inserts those values into postfix configuration
#!/bin/sh main='/usr/syno/mailstation/etc/main.cf' #main='./main.cf' #map='./smtp_auth' map='/usr/syno/mailstation/etc/smtp_auth' echo -n 'Hostname of relayhost: ' while read relayhost do [ "x$relayhost" != 'x' ] && break echo -n 'Hostname of relayhost: ' && continue done echo -n "set $relayhost as relay (r) or fallback (f)? Default f: " while read type do case $type in 'r' | 'f') break ;; *) type='f' break ;; esac done echo -n "Username for login on ${relayhost}: " while read user do [ "x$user" != 'x' ] && break done if [ "x$user" != 'x' ] then echo -n "Password of $user @ $relayhost: " while read passwort do break done fi for i in relayhost smtp_sasl_auth_enable smtp_sasl_password_maps smtp_sasl_security_options smtp_use_tls smtp_enforce_tls smtp_tls_enforce_peername do case $i in 'relayhost') [ "$type" == 'f' ] && echo 'fallback_relay = '$relayhost >> $main [ "$type" == 'r' ] && echo 'relayhost = '$relayhost >> $main ;; 'smtp_sasl_auth_enable' | 'smtp_use_tls' | 'smtp_enforce_tls') echo "$i = yes" >> $main ;; 'smtp_sasl_password_maps') echo "$i = $map" >> $main echo "$relayhost ${user}:${passwort}" >> $map /usr/syno/mailstation/sbin/postmap $map ;; 'smtp_sasl_security_options') echo "$i = noanonymous" >> $main ;; 'smtp_tls_enforce_peername') echo "$i = no" >> $main ;; *) continue ;; esac done