package web_server
import (
"github.com/russross/blackfriday/v2"
"github.com/GRFreire/nthmail/pkg/mail_utils"
)
templ mail_body_comp(rcpt_addr string, m mail_utils.Mail_obj) {
nthmail.xyz
@styles()
@header(rcpt_addr)
@mime_type(m.Body[m.PreferedBodyIndex])
}
templ mime_type(b mail_utils.Mail_body) {
switch b.MimeType {
case mail_utils.Html:
@body_html(b.Data)
case mail_utils.Markdown:
@body_markdown(b.Data)
case mail_utils.PlainText:
@body_plain(b.Data)
default:
@body_plain(b.Data)
}
}
templ body_plain(s string) {
}
templ body_html(s string) {
@templ.Raw(s)
}
templ body_markdown(s string) {
{ string(blackfriday.Run([]byte(s))) }
}