gomail

Golang multiple recipients with gomail.v2

血红的双手。 提交于 2019-12-21 14:52:57
问题 The only way that I've used to send emails via gomail.v2 is using the Send() function to each email in a for loop. But I need to show the other email addresses those the same email have been sent. for _, recipient := range os.Args[3:] { mail.SetAddressHeader("From", "my@mail.com", "My Name") mail.SetHeader("To", recipient) mail.SetHeader("Subject", os.Args[2]) mail.SetBody("text/html", os.Args[1]) if err := dialer.DialAndSend(mail); err != nil { log.Printf("Could not send email to %q: %v",

Send emails in go through Exim (without smtp)?

旧城冷巷雨未停 提交于 2019-12-11 02:34:42
问题 I'm currently using "gopkg.in/gomail.v2" to send email with following code found here package main import ( "bytes" "fmt" "gopkg.in/gomail.v2" ) func main() { m := gomail.NewMessage() m.SetHeader("From", "me@example.com") m.SetHeader("To", "you@example.com") m.SetAddressHeader("Bcc", "youbcc@example.com", "Bcc Email") m.SetHeader("Bcc", "anotherbcc@example.com", "yetbcc@example.com") m.SetHeader("Reply-To", "me@example.com") m.SetHeader("Subject", "Subject is to gomail to be discussed") body