diff --git a/email/base.gohtml b/email/base.gohtml
index f30654c..c5d2968 100644
--- a/email/base.gohtml
+++ b/email/base.gohtml
@@ -347,7 +347,22 @@
{{ if .Sender }}{{.Sender}}{{else}}{{.App.Name}}{{end}}
-
+ {{ with .Actions }}
+
+
+ {{ range $action := . }}
+ {{if $action.Button.Text}}
+
+
+ {{$.App.TroubleText | replace "{ACTION}" $action.Button.Text}}
+ {{ $action.Button.Link }}
+ |
+
+ {{ end }}
+ {{ end }}
+
+
+ {{ end }}
diff --git a/email/email.go b/email/email.go
index 7ddd31a..0037f7e 100644
--- a/email/email.go
+++ b/email/email.go
@@ -15,10 +15,11 @@ func init() {
}
type App struct {
- Name string
- Link string
- Logo string
- Copyright string
+ Name string
+ Link string
+ Logo string
+ Copyright string
+ TroubleText string
}
type Button struct {
diff --git a/email/engine.go b/email/engine.go
index 9703fae..a061efa 100644
--- a/email/engine.go
+++ b/email/engine.go
@@ -4,6 +4,7 @@ import (
"bytes"
_ "embed"
"html/template"
+ "strings"
"github.com/vanng822/go-premailer/premailer"
"github.com/yuin/goldmark"
@@ -29,6 +30,9 @@ func init() {
"mul": func(a, b int) int {
return a * b
},
+ "replace": func(from, to, input string) string {
+ return strings.Replace(input, from, to, -1)
+ },
}).Parse(mailTmpl))
}
diff --git a/email/service.go b/email/service.go
index 3770d84..fd12841 100644
--- a/email/service.go
+++ b/email/service.go
@@ -37,5 +37,6 @@ func setupDefault() {
time.Now().Year(), app.Name)
app.Link = "https://kumoly.io"
app.Logo = "http://www.duchess-france.org/wp-content/uploads/2016/01/gopher.png"
+ app.TroubleText = "If you’re having trouble with the button '{ACTION}', copy and paste the URL below into your web browser."
dial = gomail.NewDialer("mail.kumoly.io", 587, "test@kumoly.io", "test")
}