From d6072a730abf0ef293de79d6cdf1b90e6425051c Mon Sep 17 00:00:00 2001 From: hoelee Date: Tue, 9 Jun 2026 09:00:00 +0800 Subject: [PATCH] feat(shell-sync): send_notification() part 2/3 --- platform/shell-sync/sync.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/platform/shell-sync/sync.sh b/platform/shell-sync/sync.sh index 07611aab..2a95b258 100644 --- a/platform/shell-sync/sync.sh +++ b/platform/shell-sync/sync.sh @@ -103,3 +103,22 @@ send_notification() { return 0 fi + config="$(mktemp "${PID_DIR}/msmtp.XXXXXX")" + chmod 600 "$config" + { + printf 'defaults\n' + printf 'host %s\n' "$SMTP_HOST" + printf 'port %s\n' "$SMTP_PORT" + printf 'from %s\n' "$SMTP_FROM" + if [ -n "$SMTP_USER" ]; then + printf 'auth on\nuser %s\npassword %s\n' "$SMTP_USER" "$SMTP_PASS" + else + printf 'auth off\n' + fi + case "$SMTP_TLS" in + starttls) printf 'tls on\ntls_starttls on\n' ;; + tls) printf 'tls on\ntls_starttls off\n' ;; + none) printf 'tls off\n' ;; + esac + } > "$config" +