From 2a38265eadb4a328d1674125eb3f47f0dd9f405f Mon Sep 17 00:00:00 2001 From: WLTBAgent Date: Mon, 23 Feb 2026 22:35:32 +0000 Subject: [PATCH] Fix SMTP username/password defaults to only apply when BOTH are empty Fixed issue where read -sp (silent prompt) with default ${SMTP_USER:-$IMAP_USER} would use default even when user provided a value. Now only uses IMAP defaults when BOTH SMTP username AND password are empty (user skipped both prompts). This preserves user's explicit values while correctly handling the case where user presses Enter on optional SMTP prompts. --- build.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 724a4b5..efb3c21 100755 --- a/build.sh +++ b/build.sh @@ -58,9 +58,21 @@ read -p "SMTP Port (default: 465 for SSL, 587 for STARTTLS): " SMTP_PORT SMTP_PORT=${SMTP_PORT:-465} read -p "SMTP Username (default: same as IMAP): " SMTP_USER -SMTP_USER=${SMTP_USER:-$IMAP_USER} +read -sp SMTP_USER +if [ -z "$SMTP_USER" ] && [ -z "$SMTP_PASS" ]; then + # Only use IMAP defaults if BOTH SMTP username and password are empty + SMTP_USER=${SMTP_USER:-$IMAP_USER} +else + SMTP_USER=${SMTP_USER} +fi read -sp "SMTP Password (default: same as IMAP): " SMTP_PASS +if [ -z "$SMTP_USER" ] && [ -z "$SMTP_PASS" ]; then + # Only use IMAP defaults if BOTH SMTP username and password are empty + SMTP_PASS=${SMTP_PASS:-$IMAP_PASS} +else + SMTP_PASS=${SMTP_PASS} +fi if [ -z "$SMTP_PASS" ]; then SMTP_PASS="$IMAP_PASS" fi