-
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.
DE-1388 (mg *MailgunImpl) Send should accept interface, not struct (#368
- Loading branch information
Showing
12 changed files
with
156 additions
and
213 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 |
---|---|---|
|
@@ -47,7 +47,7 @@ func main() { | |
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() | ||
|
@@ -290,7 +290,7 @@ func main() { | |
subject := "HTML email!" | ||
recipient := "[email protected]" | ||
|
||
message := mailgun.NewMessage(sender, subject, "", recipient) | ||
message := mailgun.NewMessage(yourDomain, sender, subject, "", recipient) | ||
body := ` | ||
<html> | ||
<body> | ||
|
@@ -351,7 +351,7 @@ func main() { | |
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 { | ||
|
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 |
---|---|---|
|
@@ -779,7 +779,7 @@ func SendMimeMessage(domain, apiKey string) (string, error) { | |
return "", err | ||
} | ||
|
||
m := mailgun.NewMIMEMessage(mimeMsgReader, "[email protected]") | ||
m := mailgun.NewMIMEMessage(domain, mimeMsgReader, "[email protected]") | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) | ||
defer cancel() | ||
|
@@ -824,6 +824,7 @@ func SendSimpleMessage(domain, apiKey string) (string, error) { | |
func SendTaggedMessage(domain, apiKey string) (string, error) { | ||
mg := mailgun.NewMailgun(domain, apiKey) | ||
m := mailgun.NewMessage( | ||
domain, | ||
"Excited User <YOU@YOUR_DOMAIN_NAME>", | ||
"Hello", | ||
"Testing some Mailgun awesomeness!", | ||
|
@@ -845,6 +846,7 @@ func SendTaggedMessage(domain, apiKey string) (string, error) { | |
func SendTemplateMessage(domain, apiKey string) (string, error) { | ||
mg := mailgun.NewMailgun(domain, apiKey) | ||
m := mailgun.NewMessage( | ||
domain, | ||
"Excited User <YOU@YOUR_DOMAIN_NAME>", | ||
"Hey %recipient.first%", | ||
"If you wish to unsubscribe, click http://mailgun/unsubscribe/%recipient.id%", | ||
|
@@ -939,7 +941,7 @@ func SendMessageWithTemplate(domain, apiKey string) error { | |
time.Sleep(time.Second * 1) | ||
|
||
// Create a new message with template | ||
m := mailgun.NewMessage("Excited User <[email protected]>", "Template example", "") | ||
m := mailgun.NewMessage(domain, "Excited User <[email protected]>", "Template example", "") | ||
m.SetTemplate("my-template") | ||
|
||
// Add recipients | ||
|
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 |
---|---|---|
|
@@ -112,7 +112,7 @@ Testing some Mailgun MIME awesomeness! | |
defer cancel() | ||
|
||
mg := mailgun.NewMailgun("example.com", "my_api_key") | ||
m := mailgun.NewMIMEMessage(io.NopCloser(strings.NewReader(exampleMime)), "[email protected]") | ||
m := mailgun.NewMIMEMessage("example.com", io.NopCloser(strings.NewReader(exampleMime)), "[email protected]") | ||
_, id, err := mg.Send(ctx, m) | ||
if err != nil { | ||
log.Fatal(err) | ||
|
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.