update
This commit is contained in:
@@ -80,10 +80,16 @@ func SendEmail(to []string, cc []string, name, subject, message, htmlString stri
|
|||||||
body := htmlString
|
body := htmlString
|
||||||
messages := []byte(sender + subjectt + mime + body)
|
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)
|
auth := smtp.PlainAuth("", config.Mail().AuthEmail, config.Mail().AuthPassword, config.Mail().SMTPHost)
|
||||||
smtpAddr := fmt.Sprintf("%s:%d", config.Mail().SMTPHost, config.Mail().SMTPPort)
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,6 +227,12 @@ func Route(db *gorm.DB) {
|
|||||||
|
|
||||||
sendTo := request.To
|
sendTo := request.To
|
||||||
|
|
||||||
|
for _, v := range request.CC {
|
||||||
|
if v != "" {
|
||||||
|
sendTo = append(sendTo, request.CC...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Data struct {
|
type Data struct {
|
||||||
Message string
|
Message string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user