diff --git a/pkg/email/send.go b/pkg/email/send.go index edcc518..584031d 100644 --- a/pkg/email/send.go +++ b/pkg/email/send.go @@ -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 }