Improve the menus alot!

This commit is contained in:
Daniel Hansson 2020-10-02 21:49:10 +02:00 committed by GitHub
parent 744fca92e5
commit a21e81a378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,22 +77,68 @@ case "$PROTOCOL" in
;;
esac
# Enter Port or just use standard port (defined by usage of ssl)
SMTP_PORT=$(input_box_flow "Please enter the port for your mailserver.
The default port based on your protocol setting is '$DEFAULT_PORT'.
Please type the port that you want to use into the inputbox.")
# Enter if you want to use ssl
PROTOCOL="$(whiptail --title "$TITLE" --nocancel --menu \
"Please choose the encryption protocol for your mailserver.
$MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
"SSL" "" \
"STARTTLS" "" \
"NO ENCRYPTION" "" 3>&1 1>&2 2>&3)
if [ -z "$PROTOCOL" ]
then
exit 1
fi
case "$PROTOCOL" in
"SSL")
DEFAULT_PORT=465
;;
"STARTTLS")
DEFAULT_PORT=587
;;
"NO ENCRYPTION")
DEFAULT_PORT=25
;;
*)
;;
esac
# Enter custom port or just use the default port
SMTP_PORT=$(whiptail --title "$TITLE" --nocancel --menu \
"Based on your selection of encryption the default port is $DEFAULT_PORT. Would you like to use that port or something else?
$MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
"Use default port" "($DEFAULT_PORT)" \
"Enter another port" "" 3>&1 1>&2 2>&3)
if [ -z "$SMTP_PORT" ]
then
exit 1
fi
case "$SMTP_PORT" in
"Use default port")
SMTP_PORT="$DEFAULT_PORT"
;;
"Enter another port")
SMTP_PORT="$(input_box_flow 'Please enter the port for your mailserver.')"
;;
*)
;;
esac
# Enter your mail username
MAIL_USERNAME=$(input_box_flow "Please enter the username for the login to your mail provider.
E.g. mail@example.com
Please note: the domain used for your mail username and the mailserver domain have to match!")
if yesno_box_yes "Do you have a username and password for the login to $MAIL_SERVER?"
then
MAIL_USERNAME=$(input_box_flow "Please enter the username for the login to your mail provider.\nE.g. user@$MAIL_SERVER")
# Enter your mailuser password
MAIL_PASSWORD=$(input_box_flow "Please enter the password for your mailserver user.")
# Enter your mailuser password
MAIL_PASSWORD=$(input_box_flow "Please enter the password for your mailserver user.")
fi
# Enter the recipient
RECIPIENT=$(input_box_flow "Please enter the recipient mail-address that shall receive all mails.
E.g. mail@example.com")
RECIPIENT=$(input_box_flow "Please enter the recipient email address that shall receive all mails.\nE.g. mail@example.com")
# Present what we gathered, if everything okay, write to files
msg_box "These are the settings that will be used. Please check that everything seems correct.