From 482b8092529430f4c5b1d038906adf7ac3630984 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 9 Sep 2023 21:44:47 -0500 Subject: [PATCH] Update install-postfix.sh --- install-postfix.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install-postfix.sh b/install-postfix.sh index a2e08aa..476778c 100755 --- a/install-postfix.sh +++ b/install-postfix.sh @@ -79,7 +79,9 @@ case "$choice" in elif [ "${TESTEMAIL}" = "mms" ]; then TESTEMAIL='9208839613@mms.att.net' fi - echo "Received from: $(hostname) ($(hostname -f))" | mail -r ${pffromemail}@scity.us -s "Test Message (Postfix Install)" $TESTEMAIL + [ "$(ip route | awk '/default/ { print $5 }')" == "link" ] && HIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) || + HIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) + echo "Received from: $(hostname) {$(hostname -f [${HIP}]}" | mail -r ${pffromemail}@scity.us -s "Test Message (Postfix Install)" $TESTEMAIL fi echo ""