Last active
March 28, 2017 12:13
-
-
Save momota10/1984d7f79032c8162b08c2ecaf6e2d6f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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