From d47b39bb1d50cefb204563985a52e5c28cd1eba3 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 5 Jan 2024 19:43:45 +0300 Subject: [PATCH] link-fix --- server/email/mailgun.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/email/mailgun.go b/server/email/mailgun.go index 26e1129..84fd3b5 100644 --- a/server/email/mailgun.go +++ b/server/email/mailgun.go @@ -23,7 +23,15 @@ func MailgunRest(to string, data map[string]interface{}, subject string, templat mg := mailgun.NewMailgun(mailgunDomain, mailgunAPIKey) m := mg.NewMessage(sender, subject, "", to) m.SetTemplate(template) - m.AddTemplateVariable("validation_url", data["validation_url"]) + m.AddTemplateVariable("verification_url", data["verification_url"]) + userMap, ok := data["user"].(map[string]interface{}) + if !ok { + log.Println("Error: Unable to retrieve user information from the data map.") + } + userName, ok := userMap["GivenName"].(string) + if ok { + m.AddTemplateVariable("username", userName) + } ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) defer cancel()