feat: add support for sending email to the docker image

This commit is contained in:
Emmanuel BENOîT 2025-01-02 16:54:24 +01:00
parent 31f5063a96
commit ea572cb82a
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
4 changed files with 62 additions and 4 deletions

View file

@ -1,5 +1,29 @@
#!/bin/bash
(
cat <<EOF
defaults
tls $SMTP_TLS
tls_trust_file /etc/ssl/certs/ca-certificates.crt
syslog on
account account
host $SMTP_HOST
port $SMTP_PORT
auth $SMTP_AUTH
from $LW_MAIL_FROM
EOF
if [ "$SMTP_AUTH" = "on" ]; then
echo "user $SMTP_USER"
echo 'passwordeval "cat /run/secrets/smtp_password"'
fi
cat <<EOF
account default : account
aliases /etc/aliases
EOF
) > /etc/msmtprc
socat -u \
UNIX-LISTEN:/dev/log,reuseaddr,mode=666,fork \
SYSTEM:"(sed -z 's/$/\\\\n/'; /bin/echo)" \