diff --git a/postinstall b/postinstall index 6a3b3c5..e5b11ac 100755 --- a/postinstall +++ b/postinstall @@ -424,7 +424,10 @@ ask_mail_config(){ fi recipientaddress="" smtphost=$(grep relayhost /etc/postfix/main.cf | cut -d : -f1 | cut -d ' ' -f3 | cut -d ']' -f1 | cut -d '[' -f2) - smtpport=25 + smtpport=$(grep relayhost /etc/postfix/main.cf | cut -d':' -f2) + if [[ $smtpport == "" ]] || [[ $smtpport == "relayhost" ]]; then + smtpport=25 + fi username="" password="" if [ -f /etc/postfix/sasl_passwd ]; then @@ -442,8 +445,8 @@ ask_mail_config(){ if ! displayname=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender display name." 9 76 $(hostname -f) 3>&1 1>&2 2>&3); then cancel_dialog; fi if ! recipientaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the email address to receive notifications." 9 76 $(pvesh get access/users/root@pam --output-format yaml| grep email | cut -d' ' -f2) 3>&1 1>&2 2>&3); then cancel_dialog; fi if ! smtphost=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter the servername of your smarthost." 9 76 $smtphost 3>&1 1>&2 2>&3); then cancel_dialog; fi - smtpport=$(inputbox_int 'MAIL DELIVERY' 'Please enter the port of your smarthost' 7 $(grep relayhost /etc/postfix/main.cf | cut -d':' -f2)) - if ! senderaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender email address." 9 76 3>&1 1>&2 2>&3); then cancel_dialog; fi + smtpport=$(inputbox_int 'MAIL DELIVERY' 'Please enter the port of your smarthost' 7 $smtpport) + if ! senderaddress=$(whiptail --title "MAIL DELIVERY" --backtitle "$PROG" --inputbox "Please enter your sender email address." 9 76 $senderaddress 3>&1 1>&2 2>&3); then cancel_dialog; fi if whiptail --title "MAIL DELIVERY" \ --backtitle "$PROG" \ --yes-button "CONFIGURE AUTH" \