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()