update
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -227,6 +227,12 @@ func Route(db *gorm.DB) {
|
||||
|
||||
sendTo := request.To
|
||||
|
||||
for _, v := range request.CC {
|
||||
if v != "" {
|
||||
sendTo = append(sendTo, request.CC...)
|
||||
}
|
||||
}
|
||||
|
||||
type Data struct {
|
||||
Message string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user