-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple mails in CC header #93
Comments
I read the source code and find it supports the multi-mails in cc list. But in a indirect way. func dosendmail() {
var tt []*gomail.Message //m ...*Message
ccAdd := []string{0: "first@gmail.com", 1: "second@gmail.com"}
for _, ccaddress := range ccAdd {
m := gomail.NewMessage()
m.SetHeader("From", fromAdd)
m.SetHeader("To", toAdd)
m.SetAddressHeader("Cc", ccaddress, "ccname")
m.SetHeader("Subject", "Hello!")
m.SetBody("text/html", "Hello <b>first</b> and <i>second</i>!")
m.Attach("test.gofile") //attachment
tt = append(tt, m) // every mail added here
}
d := gomail.NewDialer(smtpAdd, 25, fromAdd, pwd)
d.TLSConfig = &tls.Config{InsecureSkipVerify: true}
// Send the email to receiver, first and second.
if err := d.DialAndSend(tt...); err != nil { //dial and sent via tt
text := fmt.Sprintf("%v", err)
if strings.Contains(text, "535 Error: authentication failed") { //sometimes it will fail in authentication,just retry
fmt.Println(text, "\t", "retrying sending e-mail")
dosendmail()
}
} else {
fmt.Println("Success")
}
}
Each one in the cc list will receive one mail which sent to the RECEIVER and cc to himself(can not see others who also in the cc list). |
This works for me |
@yinfxs what is the cc or to list can not hard code? |
Have the same question |
Since
|
Can we have a method for adding multiple mails in cc header?
The text was updated successfully, but these errors were encountered: