Skip to content

Instantly share code, notes, and snippets.

@momota10s
Last active March 28, 2017 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save momota10s/1984d7f79032c8162b08c2ecaf6e2d6f to your computer and use it in GitHub Desktop.
Save momota10s/1984d7f79032c8162b08c2ecaf6e2d6f to your computer and use it in GitHub Desktop.
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