master
Evan Chen 2021-12-29 10:28:09 +08:00
parent 0a1c865421
commit 6307db21d9
5 changed files with 29 additions and 5 deletions

View File

@ -15,7 +15,7 @@
height: 100%;
margin: 0;
line-height: 1.4;
background-color: #F2F4F6;
background-color: {{.App.Theme}};
color: #74787E;
-webkit-text-size-adjust: none;
}
@ -27,7 +27,7 @@
width: 100%;
margin: 0;
padding: 0;
background-color: #F2F4F6;
background-color: {{.App.Theme}};
}
.email-content {
width: 100%;
@ -46,7 +46,7 @@
.email-masthead_name {
font-size: 16px;
font-weight: bold;
color: #2F3133;
color: {{.App.TitleColor}};
text-decoration: none;
text-shadow: 0 1px 0 white;
}
@ -74,7 +74,7 @@
text-align: center;
}
.email-footer p {
color: #AEAEAE;
color: {{.App.FooterColor}};
}
.body-action {
width: 100%;
@ -343,7 +343,7 @@
{{/* End Email */}}
<p>
{{if .Signature}}{{.Signature}}{{else}}Best Regards{{end}},
{{if .Signature}}{{.Signature}},{{else}}Best Regards,{{end}}
<br />
{{ if .Sender }}{{.Sender}}{{else}}{{.App.Name}}{{end}}
</p>

View File

@ -12,6 +12,7 @@ func init() {
viper.SetDefault("email.username", "test@kumoly.io")
viper.SetDefault("email.password", "test")
viper.SetDefault("logo", "http://www.duchess-france.org/wp-content/uploads/2016/01/gopher.png")
viper.SetDefault("email.theme", "#F2F4F6")
}
type App struct {
@ -20,6 +21,9 @@ type App struct {
Logo string
Copyright string
TroubleText string
Theme string
TitleColor string
FooterColor string
}
type Button struct {

View File

@ -47,6 +47,11 @@ func TestSend(t *testing.T) {
err := Send("test@kumoly.io",
[]string{"test@kumoly.io"}, "TestSend",
&Body{
App: App{
Logo: "https://www.taishinlife.com.tw/assets/images/ui/site-header/taishin/logo.svg",
Theme: "#d70c18",
FooterColor: "#ffffff",
},
Greeting: "歡迎",
Intros: []string{"testing 1.", "loramipsum...."},
Outros: []string{"testing 2,", "blah blah blah..."},

View File

@ -75,4 +75,13 @@ func merge(base *App) {
if base.TroubleText == "" {
base.TroubleText = app.TroubleText
}
if base.Theme == "" {
base.Theme = app.Theme
}
if base.TitleColor == "" {
base.TitleColor = app.TitleColor
}
if base.FooterColor == "" {
base.FooterColor = app.FooterColor
}
}

View File

@ -21,6 +21,9 @@ func (srv *Service) Init() error {
time.Now().Year(), app.Name)
app.Link = viper.GetString("server.url")
app.Logo = viper.GetString("logo")
app.Theme = viper.GetString("email.theme")
app.TitleColor = "#2F3133"
app.FooterColor = "#AEAEAE"
dial = DefaultDailer()
@ -42,6 +45,9 @@ func setupDefault() {
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."
app.Theme = "#F2F4F6"
app.TitleColor = "#2F3133"
app.FooterColor = "#AEAEAE"
dial = gomail.NewDialer("mail.kumoly.io", 587, "test@kumoly.io", "test")
}