package emails import "github.com/go-hermes/hermes/v2" // hermesTheme is the theme by default type hermesTheme struct{} func (dt *hermesTheme) Styles() hermes.StylesDefinition { return hermes.Default{}.Styles() } func newHermesTheme() hermes.Theme { return &hermesTheme{} } // Name returns the name of the default theme func (dt *hermesTheme) Name() string { return "default" } // HTMLTemplate returns a Golang template that will generate an HTML email. func (dt *hermesTheme) HTMLTemplate() string { return `
` } // PlainTextTemplate returns a Golang template that will generate an plain text email. func (dt *hermesTheme) PlainTextTemplate() string { return `

{{if .Email.Body.Title }}{{ .Email.Body.Title }}{{ else }}{{ .Email.Body.Greeting }} {{ .Email.Body.Name }},{{ end }}

{{ with .Email.Body.Intros }} {{ range $line := . }}

{{ $line }}

{{ end }} {{ end }} {{ if (ne .Email.Body.FreeMarkdown "") }} {{ .Email.Body.FreeMarkdown.ToHTML }} {{ else }} {{ with .Email.Body.Dictionary }} {{ end }} {{ with .Email.Body.Table }} {{ $data := .Data }} {{ $columns := .Columns }} {{ if gt (len $data) 0 }} {{ $col := index $data 0 }} {{ range $entry := $col }} {{ end }} {{ range $row := $data }} {{ range $cell := $row }} {{ end }} {{ end }}
{{ $entry.Key }}
{{ $cell.Value }}
{{ end }} {{ end }} {{ with .Email.Body.Actions }} {{ range $action := . }}

{{ $action.Instructions }} {{ if $action.InviteCode }} {{ $action.InviteCode }} {{ end }} {{ if $action.Button.Link }} {{ $action.Button.Link }} {{ end }}

{{ end }} {{ end }} {{ end }} {{ with .Email.Body.Outros }} {{ range $line := . }}

{{ $line }}

{{ end }} {{ end }}

{{.Email.Body.Signature}},
{{.Hermes.Product.Name}} - {{.Hermes.Product.Link}}

{{.Hermes.Product.Copyright}}

` }