master
Evan Chen 2021-12-25 03:31:53 +08:00
parent afb7664ebf
commit df63ab8d5e
4 changed files with 26 additions and 5 deletions

View File

@ -347,7 +347,22 @@
<br />
{{ if .Sender }}{{.Sender}}{{else}}{{.App.Name}}{{end}}
</p>
{{ with .Actions }}
<table class="body-sub">
<tbody>
{{ range $action := . }}
{{if $action.Button.Text}}
<tr>
<td>
<p class="sub">{{$.App.TroubleText | replace "{ACTION}" $action.Button.Text}}</p>
<p class="sub"><a href="{{ $action.Button.Link }}">{{ $action.Button.Link }}</a></p>
</td>
</tr>
{{ end }}
{{ end }}
</tbody>
</table>
{{ end }}
</td>
</tr>
</table>

View File

@ -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 {

View File

@ -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))
}

View File

@ -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 youre 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")
}