fix(mail): add support for BCC in email sending

This commit is contained in:
2026-08-23 11:31:43 +02:00
parent 3dc2e09aeb
commit 5b3c256a5e
3 changed files with 10 additions and 1 deletions
+1
View File
@@ -27,6 +27,7 @@ email:
smtp_pass: ""
from: ""
to: "" # couple's inbox, receives RSVP + photo notifications
bcc: "" # optional; comma-separated list of extra blind-copy recipients
upload:
max_size_mb: 15
+1
View File
@@ -53,6 +53,7 @@ type EmailConfig struct {
SMTPPass string `yaml:"smtp_pass"`
From string `yaml:"from"`
To string `yaml:"to"`
Bcc string `yaml:"bcc"` // optional; comma-separated list of extra blind-copy recipients
}
type UploadConfig struct {
+8 -1
View File
@@ -48,7 +48,14 @@ func (m *Mailer) send(subject, body string) error {
m.cfg.From, m.cfg.To, subject, newMessageID(m.cfg.From), time.Now().Format(time.RFC1123Z), body,
)
return smtp.SendMail(addr, auth, m.cfg.From, []string{m.cfg.To}, []byte(msg))
recipients := []string{m.cfg.To}
for _, bcc := range strings.Split(m.cfg.Bcc, ",") {
if bcc = strings.TrimSpace(bcc); bcc != "" {
recipients = append(recipients, bcc)
}
}
return smtp.SendMail(addr, auth, m.cfg.From, recipients, []byte(msg))
}
func (m *Mailer) SendRSVP(r store.RSVP) error {