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

View File

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

View File

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

View File

@ -75,4 +75,13 @@ func merge(base *App) {
if base.TroubleText == "" { if base.TroubleText == "" {
base.TroubleText = app.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) time.Now().Year(), app.Name)
app.Link = viper.GetString("server.url") app.Link = viper.GetString("server.url")
app.Logo = viper.GetString("logo") app.Logo = viper.GetString("logo")
app.Theme = viper.GetString("email.theme")
app.TitleColor = "#2F3133"
app.FooterColor = "#AEAEAE"
dial = DefaultDailer() dial = DefaultDailer()
@ -42,6 +45,9 @@ func setupDefault() {
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." 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") dial = gomail.NewDialer("mail.kumoly.io", 587, "test@kumoly.io", "test")
} }