Fix Send Reminder emailing only sender, not players

SendEmail never read Email.BccAddress, so the player recipients
attached as Bcc were silently dropped from the SMTP envelope and
only the hardcoded To address (the sender) ever received the mail.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Harry Culpan 2026-07-04 21:50:21 -04:00
parent 5f1a48b1be
commit f76bdd2656

View file

@ -12,10 +12,10 @@ func SendEmail(email *Email) error {
return err
}
return sendEmail(config.Username, config.Password, config.SmtpServer, int(SMTP_SERVICE), email.ToAddress, email.Subject, email.Body)
return sendEmail(config.Username, config.Password, config.SmtpServer, int(SMTP_SERVICE), email.ToAddress, email.BccAddress, email.Subject, email.Body)
}
func sendEmail(username, password, server string, port int, to []string, subject, body string) error {
func sendEmail(username, password, server string, port int, to []string, bcc []string, subject, body string) error {
auth := smtp.PlainAuth("", username, password, server)
msg := "From: " + username + "\r\n" +
@ -24,7 +24,9 @@ func sendEmail(username, password, server string, port int, to []string, subject
"\r\n" +
body
err := smtp.SendMail(server+":"+strconv.Itoa(port), auth, username, to, []byte(msg))
recipients := append(append([]string{}, to...), bcc...)
err := smtp.SendMail(server+":"+strconv.Itoa(port), auth, username, recipients, []byte(msg))
if err != nil {
return err
}