From af7c56a8571f3bdcc12a2052f95d9b07fae77acb Mon Sep 17 00:00:00 2001 From: Drew Smirnoff Date: Wed, 25 Feb 2026 10:00:31 +0400 Subject: [PATCH] fix!: sending from wrong email (#199) (#200) --- sender/sender.go | 6 +++--- tui/composer.go | 6 +++--- tui/composer_test.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sender/sender.go b/sender/sender.go index 6d16f14aa7ef5c9cb52f68761ba90df747a0f1e8..e21cb60860cf9da85f952fc2d8a0de2781e4623d 100644 --- a/sender/sender.go +++ b/sender/sender.go @@ -37,9 +37,9 @@ func SendEmail(account *config.Account, to, cc, bcc []string, subject, plainBody auth := smtp.PlainAuth("", account.Email, account.Password, smtpServer) - fromHeader := account.Email + fromHeader := account.FetchEmail if account.Name != "" { - fromHeader = fmt.Sprintf("%s <%s>", account.Name, account.Email) + fromHeader = fmt.Sprintf("%s <%s>", account.Name, account.FetchEmail) } // Main message buffer @@ -52,7 +52,7 @@ func SendEmail(account *config.Account, to, cc, bcc []string, subject, plainBody "To": strings.Join(to, ", "), "Subject": subject, "Date": time.Now().Format(time.RFC1123Z), - "Message-ID": generateMessageID(account.Email), + "Message-ID": generateMessageID(account.FetchEmail), "Content-Type": "multipart/mixed; boundary=" + mainWriter.Boundary(), } diff --git a/tui/composer.go b/tui/composer.go index 5c9d1376d06179cb51a51662fa252e7f181dc32e..06e46c8c001124ecdbfc30e8f58307ae919170f7 100644 --- a/tui/composer.go +++ b/tui/composer.go @@ -166,9 +166,9 @@ func (m *Composer) getFromAddress() string { if len(m.accounts) > 0 && m.selectedAccountIdx < len(m.accounts) { acc := m.accounts[m.selectedAccountIdx] if acc.Name != "" { - return fmt.Sprintf("%s <%s>", acc.Name, acc.Email) + return fmt.Sprintf("%s <%s>", acc.Name, acc.FetchEmail) } - return acc.Email + return acc.FetchEmail } return "" } @@ -479,7 +479,7 @@ func (m *Composer) View() string { var accountList strings.Builder accountList.WriteString("Select Account:\n\n") for i, acc := range m.accounts { - display := acc.Email + display := acc.FetchEmail if acc.Name != "" { display = fmt.Sprintf("%s (%s)", acc.Name, acc.FetchEmail) } diff --git a/tui/composer_test.go b/tui/composer_test.go index 5913865f6f10f148e80eaf87ec9183af32d53502..9a491433082b53ba9122f1ac139adb226038ebe6 100644 --- a/tui/composer_test.go +++ b/tui/composer_test.go @@ -220,7 +220,7 @@ func TestComposerUpdate(t *testing.T) { func TestComposerGetFromAddress(t *testing.T) { t.Run("With name", func(t *testing.T) { accounts := []config.Account{ - {ID: "account-1", Email: "test@example.com", Name: "Test User"}, + {ID: "account-1", FetchEmail: "test@example.com", Name: "Test User"}, } composer := NewComposerWithAccounts(accounts, "account-1", "", "", "") @@ -233,7 +233,7 @@ func TestComposerGetFromAddress(t *testing.T) { t.Run("Without name", func(t *testing.T) { accounts := []config.Account{ - {ID: "account-1", Email: "test@example.com"}, + {ID: "account-1", FetchEmail: "test@example.com"}, } composer := NewComposerWithAccounts(accounts, "account-1", "", "", "")