diff --git a/email/base.gohtml b/email/base.gohtml
index c5d2968..aac1815 100644
--- a/email/base.gohtml
+++ b/email/base.gohtml
@@ -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 */}}
- {{if .Signature}}{{.Signature}}{{else}}Best Regards{{end}},
+ {{if .Signature}}{{.Signature}},{{else}}Best Regards,{{end}}
{{ if .Sender }}{{.Sender}}{{else}}{{.App.Name}}{{end}}
diff --git a/email/email.go b/email/email.go
index 0037f7e..01b6d7c 100644
--- a/email/email.go
+++ b/email/email.go
@@ -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 {
diff --git a/email/email_test.go b/email/email_test.go
index 99b7128..a46ffb6 100644
--- a/email/email_test.go
+++ b/email/email_test.go
@@ -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..."},
diff --git a/email/engine.go b/email/engine.go
index a4d2dad..54e433c 100644
--- a/email/engine.go
+++ b/email/engine.go
@@ -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
+ }
}
diff --git a/email/service.go b/email/service.go
index cef0150..237f0eb 100644
--- a/email/service.go
+++ b/email/service.go
@@ -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 you’re 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")
}