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"
|
||||
|
||||
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 mailgunDomain = os.Getenv("MAILGUN_DOMAIN")
|
||||
|
||||
// Create custom variables JSON
|
||||
customVariablesJSON, err := json.Marshal(data)
|
||||
vars, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return err
|
||||
vars = nil
|
||||
}
|
||||
|
||||
// Create payload
|
||||
|
@ -30,7 +29,7 @@ func mailgun_send(to []string, data map[string]interface{}, subject string, temp
|
|||
"to": to,
|
||||
"subject": subject,
|
||||
"template": template,
|
||||
"h:X-Mailgun-Variables": string(customVariablesJSON),
|
||||
"h:X-Mailgun-Variables": string(vars),
|
||||
}
|
||||
|
||||
// Convert payload to JSON
|
||||
|
|
Loading…
Reference in New Issue
Block a user