update
parent
3df6dfdc3f
commit
14a5cf1615
|
@ -284,7 +284,7 @@
|
||||||
<!-- Body content -->
|
<!-- Body content -->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="content-cell">
|
<td class="content-cell">
|
||||||
<h1>{{if .Greeting}}{{.Greeting}}{{else}}Hi{{end}} {{ .Receiver }},</h1>
|
{{if .Greeting}}<h1>{{.Greeting}} {{ .Receiver }},</h1>{{end}}
|
||||||
{{/* Intros */}}
|
{{/* Intros */}}
|
||||||
{{ with .Intros }}
|
{{ with .Intros }}
|
||||||
{{ if gt (len .) 0 }}
|
{{ if gt (len .) 0 }}
|
||||||
|
@ -310,7 +310,7 @@
|
||||||
|
|
||||||
{{/* End Email */}}
|
{{/* End Email */}}
|
||||||
<p>
|
<p>
|
||||||
{{.Signature}},
|
{{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>
|
||||||
|
|
|
@ -4,13 +4,25 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSend(t *testing.T) {
|
func TestSendSimple(t *testing.T) {
|
||||||
(&Service{}).Init()
|
setupDefault()
|
||||||
err := Send("test@kumoly.io",
|
err := Send("test@kumoly.io",
|
||||||
[]string{"evanchen333@gmail.com"}, "Test Mail 2",
|
[]string{"test@kumoly.io"}, "TestSendSimple",
|
||||||
|
&Body{
|
||||||
|
Content: `Testing`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSend(t *testing.T) {
|
||||||
|
setupDefault()
|
||||||
|
err := Send("test@kumoly.io",
|
||||||
|
[]string{"test@kumoly.io"}, "TestSend",
|
||||||
&Body{
|
&Body{
|
||||||
Greeting: "歡迎",
|
Greeting: "歡迎",
|
||||||
Signature: "Best Regards",
|
|
||||||
Intros: []string{"testing 1.", "loramipsum...."},
|
Intros: []string{"testing 1.", "loramipsum...."},
|
||||||
Outros: []string{"testing 2,", "blah blah blah..."},
|
Outros: []string{"testing 2,", "blah blah blah..."},
|
||||||
Content: `
|
Content: `
|
||||||
|
@ -27,3 +39,29 @@ test||
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func TestMaintain(t *testing.T) {
|
||||||
|
setupDefault()
|
||||||
|
err := Send("test@kumoly.io",
|
||||||
|
[]string{"test@kumoly.io"}, "TestMaintain",
|
||||||
|
&Body{
|
||||||
|
Greeting: "您好",
|
||||||
|
Receiver: "管理員",
|
||||||
|
Sender: "App System",
|
||||||
|
Content: `
|
||||||
|
> _Hermes_ service will shutdown the **1st August 2017** for maintenance operations.
|
||||||
|
|
||||||
|
Services will be unavailable based on the following schedule:
|
||||||
|
| Services | Downtime |
|
||||||
|
| :------:| :-----------: |
|
||||||
|
| Service A | 2AM to 3AM |
|
||||||
|
| Service B | 4AM to 5AM |
|
||||||
|
| Service C | 5AM to 6AM |
|
||||||
|
|
||||||
|
Feel free to contact us for any question regarding this matter at [support@hermes-example.com](mailto:support@hermes-example.com) or in our [Gitter](https://gitter.im/)
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (srv Service) GetName() string { return "email.Service" }
|
||||||
func (srv *Service) Init() error {
|
func (srv *Service) Init() error {
|
||||||
app.Name = viper.GetString("name")
|
app.Name = viper.GetString("name")
|
||||||
app.Copyright = fmt.Sprintf("Copyright © %v %s. All rights reserved.",
|
app.Copyright = fmt.Sprintf("Copyright © %v %s. All rights reserved.",
|
||||||
time.Now().Year(), viper.GetString("name"))
|
time.Now().Year(), app.Name)
|
||||||
app.Link = viper.GetString("server.url")
|
app.Link = viper.GetString("server.url")
|
||||||
|
|
||||||
dial = gomail.NewDialer(
|
dial = gomail.NewDialer(
|
||||||
|
@ -29,3 +29,12 @@ func (srv *Service) Init() error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setupDefault() {
|
||||||
|
app.Name = "Kumoly Test"
|
||||||
|
app.Copyright = fmt.Sprintf("Copyright © %v %s. All rights reserved.",
|
||||||
|
time.Now().Year(), app.Name)
|
||||||
|
app.Link = "https://kumoly.io"
|
||||||
|
app.Logo = "http://www.duchess-france.org/wp-content/uploads/2016/01/gopher.png"
|
||||||
|
dial = gomail.NewDialer("mail.kumoly.io", 587, "test@kumoly.io", "test")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue