Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package main
import (
"fmt"
mailgun "github.com/mailgun/mailgun-go"
)
func main() {
mg := mailgun.NewMailgun(
"your domain",
"your api key", // API Key
"", // API Public Key (we don't use)
)
var recipients = []struct {
Email string
}{
{"recipient1@example.com"},
{"recipient2@example.com"},
{"recipient3@example.com"},
}
msg := mg.NewMessage(
"sender@example.com",
"subject",
"text",
)
msg.SetHtml("your html")
for _, recipient := range recipients {
err := msg.AddRecipient(recipient.Email)
if err != nil {
fmt.Println(err)
}
}
mg.Send(msg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment