Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func AddContact(name, email string) error {
return nil
}

email = strings.ToLower(strings.TrimSpace(email))
email = strings.ToLower(strings.Trim(strings.TrimSpace(email), ","))
name = strings.TrimSpace(name)

cache, err := LoadContactsCache()
Expand Down
14 changes: 10 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,16 @@ func (m *mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
go func() {
// Save the recipient as a contact
if msg.To != "" {
// Parse "Name <email>" format
name, email := parseEmailAddress(msg.To)
if err := config.AddContact(name, email); err != nil {
log.Printf("Error saving contact: %v", err)
recipients := strings.Split(msg.To, ",")
for _, r := range recipients {
r = strings.TrimSpace(r)
if r == "" {
continue
}
name, email := parseEmailAddress(r)
if err := config.AddContact(name, email); err != nil {
log.Printf("Error saving contact: %v", err)
}
}
}
// Delete the draft since email is being sent
Expand Down