feat(shell-sync): send_notification() part 2/3

This commit is contained in:
hoelee committed 2026-06-09 09:00:00 +08:00
1 parent 20fc621355
commit d6072a730a
1 file changed
+19
+19
View File
@@ -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"