-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
681 additions
and
683 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ var privateAPIKey = "your-private-key" | |
|
||
func main() { | ||
// Create an instance of the Mailgun Client | ||
mg := mailgun.NewMailgun(yourDomain, privateAPIKey) | ||
mg := mailgun.NewMailgun(privateAPIKey) | ||
|
||
//When you have an EU-domain, you must specify the endpoint: | ||
//mg.SetAPIBase("https://api.eu.mailgun.net/v3") | ||
|
@@ -79,9 +79,9 @@ import ( | |
func main() { | ||
// You can find the Private API Key in your Account Menu, under "Settings": | ||
// (https://app.mailgun.com/settings/api_security) | ||
mg := mailgun.NewMailgun("your-domain.com", "your-private-key") | ||
mg := mailgun.NewMailgun("your-private-key") | ||
|
||
it := mg.ListEvents(&mailgun.ListEventOptions{Limit: 100}) | ||
it := mg.ListEvents("your-domain.com", &mailgun.ListEventOptions{Limit: 100}) | ||
|
||
var page []mailgun.Event | ||
|
||
|
@@ -135,12 +135,12 @@ import ( | |
func main() { | ||
// You can find the Private API Key in your Account Menu, under "Settings": | ||
// (https://app.mailgun.com/settings/api_security) | ||
mg := mailgun.NewMailgun("your-domain.com", "your-private-key") | ||
mg := mailgun.NewMailgun("your-private-key") | ||
|
||
begin := time.Now().Add(time.Second * -3) | ||
|
||
// Very short poll interval | ||
it := mg.PollEvents(&mailgun.ListEventOptions{ | ||
it := mg.PollEvents("your-domain.com", &mailgun.ListEventOptions{ | ||
// Only events with a timestamp after this date/time will be returned | ||
Begin: begin, | ||
// How often we poll the api for new events | ||
|
@@ -210,11 +210,10 @@ import ( | |
func main() { | ||
// You can find the Private API Key in your Account Menu, under "Settings": | ||
// (https://app.mailgun.com/settings/api_security) | ||
mg := mailgun.NewMailgun("your-domain.com", "private-api-key") | ||
mg := mailgun.NewMailgun("private-api-key") | ||
mg.SetWebhookSigningKey("webhook-signing-key") | ||
|
||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | ||
|
||
var payload mailgun.WebhookPayload | ||
if err := json.NewDecoder(r.Body).Decode(&payload); err != nil { | ||
fmt.Printf("decode JSON error: %s", err) | ||
|
@@ -284,7 +283,7 @@ var privateAPIKey = "your-private-key" | |
|
||
func main() { | ||
// Create an instance of the Mailgun Client | ||
mg := mailgun.NewMailgun(yourDomain, privateAPIKey) | ||
mg := mailgun.NewMailgun(privateAPIKey) | ||
|
||
sender := "[email protected]" | ||
subject := "HTML email!" | ||
|
@@ -306,7 +305,7 @@ func main() { | |
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer cancel() | ||
|
||
// Send the message with a 10 second timeout | ||
// Send the message with a 10-second timeout | ||
resp, id, err := mg.Send(ctx, message) | ||
|
||
if err != nil { | ||
|
@@ -343,7 +342,7 @@ var privateAPIKey = "your-private-key" | |
|
||
func main() { | ||
// Create an instance of the Mailgun Client | ||
mg := mailgun.NewMailgun(yourDomain, privateAPIKey) | ||
mg := mailgun.NewMailgun(privateAPIKey) | ||
|
||
sender := "[email protected]" | ||
subject := "Fancy subject!" | ||
|
@@ -379,7 +378,7 @@ and click on the "Go" button at the top of the page. | |
European customers will need to change the default API Base to access your domains | ||
|
||
```go | ||
mg := mailgun.NewMailgun("your-domain.com", "private-api-key") | ||
mg := mailgun.NewMailgun("private-api-key") | ||
mg.SetAPIBase(mailgun.APIBaseEU) | ||
``` | ||
|
||
|
@@ -390,7 +389,6 @@ mg.SetAPIBase(mailgun.APIBaseEU) | |
To run the tests various environment variables must be set. These are: | ||
|
||
* `MG_DOMAIN` is the domain name - this is a value registered in the Mailgun admin interface. | ||
* `MG_PUBLIC_API_KEY` is the Public Validation API key - you can get this value from the Mailgun [security page](https://app.mailgun.com/settings/api_security) | ||
* `MG_API_KEY` is the Private API key - you can get this value from the Mailgun [security page](https://app.mailgun.com/settings/api_security) | ||
* `MG_EMAIL_TO` is the email address used in various sending tests. | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.