This commit is contained in:
teddy
2025-04-21 14:23:15 +07:00
parent a69b44625e
commit 062279e5d0
2 changed files with 13 additions and 1 deletions

View File

@@ -80,10 +80,16 @@ func SendEmail(to []string, cc []string, name, subject, message, htmlString stri
body := htmlString
messages := []byte(sender + subjectt + mime + body)
for _, v := range cc {
if v != "" {
to = append(to, cc...)
}
}
auth := smtp.PlainAuth("", config.Mail().AuthEmail, config.Mail().AuthPassword, config.Mail().SMTPHost)
smtpAddr := fmt.Sprintf("%s:%d", config.Mail().SMTPHost, config.Mail().SMTPPort)
err := smtp.SendMail(smtpAddr, auth, config.Mail().AuthEmail, append(to, cc...), messages)
err := smtp.SendMail(smtpAddr, auth, config.Mail().AuthEmail, to, messages)
if err != nil {
return err
}