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:
parent
5f1a48b1be
commit
f76bdd2656
1 changed files with 5 additions and 3 deletions
|
|
@ -12,10 +12,10 @@ func SendEmail(email *Email) error {
|
||||||
return err
|
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)
|
auth := smtp.PlainAuth("", username, password, server)
|
||||||
|
|
||||||
msg := "From: " + username + "\r\n" +
|
msg := "From: " + username + "\r\n" +
|
||||||
|
|
@ -24,7 +24,9 @@ func sendEmail(username, password, server string, port int, to []string, subject
|
||||||
"\r\n" +
|
"\r\n" +
|
||||||
body
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue