Skip to content

Instantly share code, notes, and snippets.

@momota10
Last active March 28, 2017 12:13
Show Gist options
  • Save momota10/1984d7f79032c8162b08c2ecaf6e2d6f to your computer and use it in GitHub Desktop.
Save momota10/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
}{
{"[email protected]"},
{"[email protected]"},
{"[email protected]"},
}
msg := mg.NewMessage(
"[email protected]",
"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