From 896e890421f7c65108e6125810cb5d35d5fd4c72 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 5 Jan 2024 13:19:46 +0300 Subject: [PATCH] less-bloat-2 --- server/email/mailgun.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/email/mailgun.go b/server/email/mailgun.go index efb8fb3..e299a7f 100644 --- a/server/email/mailgun.go +++ b/server/email/mailgun.go @@ -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