ledgersmb-docker/update_ssmtp.sh
Erik Huelsmann 1b6a2f5c99 Deprecate functionality supported by ssmtp but not by Email::Sender
The deprecation is required in order to move to built-in handling
of mail instead of relying on external handling by tools like
ssmtp.
2020-01-31 21:27:55 +01:00

23 lines
1.1 KiB
Bash

#!/bin/bash
ConfiguredComment='# install script update_ssmtp.sh has configured ssmtp'
grep -qc "$ConfiguredComment" /etc/ssmtp.conf && {
echo "smtp configured."
exit
}
[ -z "$SSMTP_FROMLINE_OVERRIDE" ] || echo "SSMTP_FROMLINE_OVERRIDE (DEPRECATED) won't be supported as of the LedgerSMB 1.8 Docker images"
[ -z "$SSMTP_AUTH_METHOD" ] || echo "SSMTP_AUTH_METHOD (DEPRECATED) won't be supported as of the LedgerSMB 1.8 Docker images"
sed -i \
-e "s/\(root=\).*\$/\1$SSMTP_ROOT/g" \
-e "s/\(mailhub=\).*\$/\1$SSMTP_MAILHUB/g" \
-e "s/\(hostname=\).*\$/\1$SSMTP_HOSTNAME/g" \
/etc/ssmtp/ssmtp.conf
[ -z "$SSMTP_USE_STARTTLS" ] || echo "UseSTARTTLS=$SSMTP_USE_STARTTLS" >> /etc/ssmtp/ssmtp.conf
[ -z "$SSMTP_AUTH_USER" ] || echo "AuthUser=$SSMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf
[ -z "$SSMTP_AUTH_PASS" ] || echo "AuthPass=$SSMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf
[ -z "$SSMTP_AUTH_METHOD" ] || echo "AuthMethod=$SSMTP_AUTH_METHOD" >> /etc/ssmtp/ssmtp.conf
[ -z "$SSMTP_FROMLINE_OVERRIDE" ] || echo "FromLineOverride=$SSMTP_FROMLINE_OVERRIDE" >> /etc/ssmtp/ssmtp.conf
echo "$ConfiguredComment" >> /etc/ssmtp/ssmtp.conf