1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

refactor: mail service abstraction layer

This commit is contained in:
Ferdinand Mütsch
2021-04-30 15:14:29 +02:00
parent 29c04c3ac5
commit a4e7158db2
10 changed files with 128 additions and 144 deletions

View File

@@ -5,6 +5,9 @@ import (
"strings"
)
const HtmlType = "text/html; charset=UTF-8"
const PlainType = "text/html; charset=UTF-8"
type Mail struct {
From MailAddress
To MailAddresses
@@ -15,13 +18,13 @@ type Mail struct {
func (m *Mail) WithText(text string) *Mail {
m.Body = text
m.Type = "text/plain; charset=UTF-8"
m.Type = PlainType
return m
}
func (m *Mail) WithHTML(html string) *Mail {
m.Body = html
m.Type = "text/html; charset=UTF-8"
m.Type = HtmlType
return m
}