-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps test #381
Closed
Closed
deps test #381
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e4a2914
DE-1386 removed deprecated (mg *MailgunImpl) NewMessage method (#365)
vtopc 34b51e0
DE-1387 Remove func (mg *MailgunImpl) NewMIMEMessage(…) *Message (#366)
vtopc a2a4cfd
DE-1388 (mg *MailgunImpl) Send should accept interface, not struct (#…
vtopc 528746b
updated README.md
vtopc 2a99c6b
Merge branch 'master' into v5.0.0-RC1
vtopc 9b43e40
Merge branch 'master' into v5.0.0-RC1
vtopc 7e12fef
DE-1394 Remove deprecated v3 Validation (#371)
vtopc 317cfaa
DE-1392 Remove deprecated GetStats (#372)
vtopc 7de53aa
DE-1410 Remove deprecated GetStoredMessageForURL() and GetStoredMessa…
vtopc 02ff37c
DE-1411 Remove deprecated VerifyWebhookRequest() method (#374)
vtopc 7933fc9
DE-1390 Remove CaptureCurlOutput (#375)
vtopc 49c465a
DE-1384 Domain agnostic API (#376)
vtopc 1c49eb6
DE-1383 Move the API version out of the base URL (#377)
vtopc 54c03d7
DE-1383 Move the API version out of the base URL 2 (#378)
vtopc 0d43085
DE-1394 Removed deprecated v3 validation fields (#379)
vtopc 5dbd0ec
blah
vtopc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# Mailgun with Go | ||
|
||
[](https://godoc.org/github.com/mailgun/mailgun-go/v4) | ||
[](https://godoc.org/github.com/mailgun/mailgun-go/v5) | ||
[](https://github.com/mailgun/mailgun-go/actions/workflows/main.yml?query=branch%3Amaster) | ||
|
||
Go library for interacting with the [Mailgun](https://mailgun.com/) [API](https://documentation.mailgun.com/en/latest/api_reference.html). | ||
|
||
## Installation | ||
|
||
If you are using [Go Modules](https://go.dev/wiki/Modules) make sure you | ||
include the `/v4` at the end of your import paths | ||
include the `/v5` at the end of your import paths | ||
```bash | ||
$ go get github.com/mailgun/mailgun-go/v4 | ||
$ go get github.com/mailgun/mailgun-go/v5 | ||
``` | ||
|
||
## Usage | ||
|
@@ -23,7 +23,7 @@ import ( | |
"log" | ||
"time" | ||
|
||
"github.com/mailgun/mailgun-go/v4" | ||
"github.com/mailgun/mailgun-go/v5" | ||
) | ||
|
||
// Your available domain names can be found here: | ||
|
@@ -36,18 +36,18 @@ var privateAPIKey = "your-private-key" | |
|
||
func main() { | ||
// Create an instance of the Mailgun Client | ||
mg := mailgun.NewMailgun(yourDomain, privateAPIKey) | ||
//When you have an EU-domain, you must specify the endpoint: | ||
//mg.SetAPIBase("https://api.eu.mailgun.net/v3") | ||
mg := mailgun.NewMailgun(privateAPIKey) | ||
|
||
// When you have an EU domain, you must specify the endpoint: | ||
// err := mg.SetAPIBase(mailgun.APIBaseEU) | ||
|
||
sender := "[email protected]" | ||
subject := "Fancy subject!" | ||
body := "Hello from Mailgun Go!" | ||
recipient := "[email protected]" | ||
|
||
// The message object allows you to add attachments and Bcc recipients | ||
message := mailgun.NewMessage(sender, subject, body, recipient) | ||
message := mailgun.NewMessage(yourDomain, sender, subject, body, recipient) | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer cancel() | ||
|
@@ -72,16 +72,16 @@ import ( | |
"fmt" | ||
"time" | ||
|
||
"github.com/mailgun/mailgun-go/v4" | ||
"github.com/mailgun/mailgun-go/v4/events" | ||
"github.com/mailgun/mailgun-go/v5" | ||
"github.com/mailgun/mailgun-go/v5/events" | ||
) | ||
|
||
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 | ||
|
||
|
@@ -129,18 +129,18 @@ import ( | |
"log" | ||
"time" | ||
|
||
"github.com/mailgun/mailgun-go/v4" | ||
"github.com/mailgun/mailgun-go/v5" | ||
) | ||
|
||
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 | ||
|
@@ -170,7 +170,7 @@ import ( | |
"fmt" | ||
"time" | ||
|
||
"github.com/mailgun/mailgun-go/v4" | ||
"github.com/mailgun/mailgun-go/v5" | ||
) | ||
|
||
// Your plan should include email validations. | ||
|
@@ -203,18 +203,17 @@ import ( | |
"net/http" | ||
"os" | ||
|
||
"github.com/mailgun/mailgun-go/v4" | ||
"github.com/mailgun/mailgun-go/v4/events" | ||
"github.com/mailgun/mailgun-go/v5" | ||
"github.com/mailgun/mailgun-go/v5/events" | ||
) | ||
|
||
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) | ||
|
@@ -271,7 +270,7 @@ import ( | |
"log" | ||
"time" | ||
|
||
"github.com/mailgun/mailgun-go/v4" | ||
"github.com/mailgun/mailgun-go/v5" | ||
) | ||
|
||
// Your available domain names can be found here: | ||
|
@@ -284,13 +283,13 @@ 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!" | ||
recipient := "[email protected]" | ||
|
||
message := mailgun.NewMessage(sender, subject, "", recipient) | ||
message := mailgun.NewMessage(yourDomain, sender, subject, "", recipient) | ||
body := ` | ||
<html> | ||
<body> | ||
|
@@ -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 { | ||
|
@@ -330,7 +329,7 @@ import ( | |
"log" | ||
"time" | ||
|
||
"github.com/mailgun/mailgun-go/v4" | ||
"github.com/mailgun/mailgun-go/v5" | ||
) | ||
|
||
// Your available domain names can be found here: | ||
|
@@ -343,15 +342,15 @@ 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!" | ||
body := "" | ||
recipient := "[email protected]" | ||
|
||
// The message object allows you to add attachments and Bcc recipients | ||
message := mailgun.NewMessage(sender, subject, body, recipient) | ||
message := mailgun.NewMessage(yourDomain, sender, subject, body, recipient) | ||
message.SetTemplate("passwordReset") | ||
err := message.AddTemplateVariable("passwordResetLink", "some link to your site unique to your user") | ||
if err != nil { | ||
|
@@ -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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package blah | ||
|
||
import _ "go.uber.org/automaxprocs" | ||
Check failure on line 3 in blah/blah.go
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not imported to go.mod