less-bloat-2
This commit is contained in:
parent
c5aaad0662
commit
896e890421
|
@ -14,14 +14,13 @@ import (
|
||||||
|
|
||||||
const apiURL = "https://api.mailgun.net/v3/%s/messages"
|
const apiURL = "https://api.mailgun.net/v3/%s/messages"
|
||||||
|
|
||||||
func mailgun_send(to []string, data map[string]interface{}, subject string, template string) error {
|
func mailgun_send(to string, data map[string]interface{}, subject string, template string) error {
|
||||||
var mailgunAPIKey = os.Getenv("MAILGUN_API_KEY")
|
var mailgunAPIKey = os.Getenv("MAILGUN_API_KEY")
|
||||||
var mailgunDomain = os.Getenv("MAILGUN_DOMAIN")
|
var mailgunDomain = os.Getenv("MAILGUN_DOMAIN")
|
||||||
|
|
||||||
// Create custom variables JSON
|
vars, err := json.Marshal(data)
|
||||||
customVariablesJSON, err := json.Marshal(data)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
vars = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create payload
|
// Create payload
|
||||||
|
@ -30,7 +29,7 @@ func mailgun_send(to []string, data map[string]interface{}, subject string, temp
|
||||||
"to": to,
|
"to": to,
|
||||||
"subject": subject,
|
"subject": subject,
|
||||||
"template": template,
|
"template": template,
|
||||||
"h:X-Mailgun-Variables": string(customVariablesJSON),
|
"h:X-Mailgun-Variables": string(vars),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert payload to JSON
|
// Convert payload to JSON
|
||||||
|
|
Loading…
Reference in New Issue
Block a user