diff --git a/internal/tui/account.go b/internal/tui/account.go index bc3d022..e2dd8d7 100644 --- a/internal/tui/account.go +++ b/internal/tui/account.go @@ -203,6 +203,9 @@ func NewAccountForm(initial Fields, editing bool) AccountForm { if initial.IMAPSecurity == "" { initial.IMAPSecurity = "tls" } + if initial.SMTPPort == "" { + initial.SMTPPort = "465" + } if initial.SMTPSecurity == "" { initial.SMTPSecurity = "tls" } diff --git a/internal/tui/account_test.go b/internal/tui/account_test.go index 0cbc13c..0c196c7 100644 --- a/internal/tui/account_test.go +++ b/internal/tui/account_test.go @@ -111,6 +111,17 @@ func TestFieldsFromAccountRoundTrip(t *testing.T) { } } +func TestNewAccountFormDefaultsSMTPPort(t *testing.T) { + f := NewAccountForm(Fields{}, false).collect() + if f.SMTPPort != "465" { + t.Fatalf("SMTP port should default to 465, got %q", f.SMTPPort) + } + // The other prefilled defaults must remain intact. + if f.IMAPPort != "993" || f.Mode != "RO" || f.IMAPSecurity != "tls" || f.SMTPSecurity != "tls" { + t.Fatalf("existing defaults regressed: %+v", f) + } +} + func TestAccountFormSubmitValid(t *testing.T) { m := NewAccountForm(validFields(), false) // Enter submits; with valid fields the form completes.