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 /> <br />
{{ if .Sender }}{{.Sender}}{{else}}{{.App.Name}}{{end}} {{ if .Sender }}{{.Sender}}{{else}}{{.App.Name}}{{end}}
</p> </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> </td>
</tr> </tr>
</table> </table>

View File

@ -15,10 +15,11 @@ func init() {
} }
type App struct { type App struct {
Name string Name string
Link string Link string
Logo string Logo string
Copyright string Copyright string
TroubleText string
} }
type Button struct { type Button struct {

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
_ "embed" _ "embed"
"html/template" "html/template"
"strings"
"github.com/vanng822/go-premailer/premailer" "github.com/vanng822/go-premailer/premailer"
"github.com/yuin/goldmark" "github.com/yuin/goldmark"
@ -29,6 +30,9 @@ func init() {
"mul": func(a, b int) int { "mul": func(a, b int) int {
return a * b return a * b
}, },
"replace": func(from, to, input string) string {
return strings.Replace(input, from, to, -1)
},
}).Parse(mailTmpl)) }).Parse(mailTmpl))
} }

View File

@ -37,5 +37,6 @@ func setupDefault() {
time.Now().Year(), app.Name) time.Now().Year(), app.Name)
app.Link = "https://kumoly.io" app.Link = "https://kumoly.io"
app.Logo = "http://www.duchess-france.org/wp-content/uploads/2016/01/gopher.png" 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") dial = gomail.NewDialer("mail.kumoly.io", 587, "test@kumoly.io", "test")
} }