Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

appview: email: support multiple recipients on `SendEmail`

also remove unnecessary error wrap

Signed-off-by: Seongmin Lee <boltlessengineer@proton.me>

author
Seongmin Lee
committer
Seongmin Lee
date (Jun 17, 2026, 2:39 AM +0900) commit b9d81230 parent 5c97f1cc change-id xruymuvt
+6 -13
+3 -8
appview/email/email.go
··· 1 1 package email 2 2 3 3 import ( 4 - "fmt" 5 4 "net" 6 5 "net/mail" 7 6 "strings" ··· 11 10 12 11 type Email struct { 13 12 From string 14 - To string 15 13 Subject string 16 14 Text string 17 15 Html string 18 16 APIKey string 19 17 } 20 18 21 - func SendEmail(email Email) error { 19 + func SendEmail(email Email, recipients ...string) error { 22 20 client := resend.NewClient(email.APIKey) 23 21 _, err := client.Emails.Send(&resend.SendEmailRequest{ 24 22 From: email.From, 25 - To: []string{email.To}, 23 + To: recipients, 26 24 Subject: email.Subject, 27 25 Text: email.Text, 28 26 Html: email.Html, 29 27 }) 30 - if err != nil { 31 - return fmt.Errorf("error sending email: %w", err) 32 - } 33 - return nil 28 + return err 34 29 } 35 30 36 31 // AddNewsletterContact creates a global contact in Resend and adds them to the newsletter segment.
+2 -3
appview/settings/settings.go
··· 354 354 return email.Email{ 355 355 APIKey: s.Config.Resend.ApiKey, 356 356 From: s.Config.Resend.SentFrom, 357 - To: emailAddr, 358 357 Subject: "Verify your Tangled email", 359 358 Text: `Click the link below (or copy and paste it into your browser) to verify your email address. 360 359 ` + verifyURL, ··· 367 366 func (s *Settings) sendVerificationEmail(w http.ResponseWriter, did, emailAddr, code string, errorContext string) error { 368 367 emailToSend := s.buildVerificationEmail(emailAddr, did, code) 369 368 370 - err := email.SendEmail(emailToSend) 369 + err := email.SendEmail(emailToSend, emailAddr) 371 370 if err != nil { 372 - s.Logger.Error("sending email", "err", err) 371 + s.Logger.Error("failed to send email", "err", err) 373 372 s.Pages.Notice(w, "settings-emails-error", fmt.Sprintf("Unable to send verification email at this moment, try again later. %s", errorContext)) 374 373 return err 375 374 }
+1 -2
appview/signup/signup.go
··· 165 165 em := email.Email{ 166 166 APIKey: s.config.Resend.ApiKey, 167 167 From: s.config.Resend.SentFrom, 168 - To: emailId, 169 168 Subject: "Verify your Tangled account", 170 169 Text: `Copy and paste this code below to verify your account on Tangled. 171 170 ` + code, ··· 173 172 <p><code>` + code + `</code></p>`, 174 173 } 175 174 176 - err = email.SendEmail(em) 175 + err = email.SendEmail(em, emailId) 177 176 if err != nil { 178 177 s.l.Error("failed to send email", "error", err) 179 178 s.pages.Notice(w, noticeId, "Failed to send email.")