diff --git a/cmd/test/main.go b/cmd/test/main.go index 33843f6..4afed13 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -1,9 +1,6 @@ package main import ( - "time" - - "github.com/rs/zerolog/log" "kumoly.io/kumoly/app/auth" "kumoly.io/kumoly/app/email" "kumoly.io/kumoly/app/history" @@ -27,26 +24,6 @@ func main() { &email.Service{}) go sys.Start() - time.Sleep(time.Second) - err := email.Send("test@kumoly.io", - []string{"evanchen333@gmail.com"}, "Test Mail", - &email.Body{ - Greeting: "歡迎", - Signature: "Best Regards", - Content: ` -# Testing - -a|b|c --|-|- -test|| - |is| - | |up`, - }, - ) - if err != nil { - log.Error().Err(err).Msg("failed to send email") - } - <-sys.Done() } diff --git a/email/base.gohtml b/email/base.gohtml index 5c69b6c..7c68eb1 100644 --- a/email/base.gohtml +++ b/email/base.gohtml @@ -297,8 +297,6 @@ {{/* Main Body */}} {{ if (ne .Content "") }} {{ .Content | ToHTML }} - {{ else }} -
No Body
{{ end }} {{/* Outros */}} diff --git a/email/email_test.go b/email/email_test.go new file mode 100644 index 0000000..45d12f0 --- /dev/null +++ b/email/email_test.go @@ -0,0 +1,29 @@ +package email + +import ( + "testing" +) + +func TestSend(t *testing.T) { + (&Service{}).Init() + err := Send("test@kumoly.io", + []string{"evanchen333@gmail.com"}, "Test Mail 2", + &Body{ + Greeting: "歡迎", + Signature: "Best Regards", + Intros: []string{"testing 1.", "loramipsum...."}, + Outros: []string{"testing 2,", "blah blah blah..."}, + Content: ` +# Testing + +a|b|c +-|-|- +test|| +-|is| +-|-|up`, + }, + ) + if err != nil { + t.Error(err) + } +}