MCPcopy
hub / github.com/dnote/dnote / SendEmail

Method SendEmail

pkg/server/mailer/backend.go:102–109  ·  view source on GitHub ↗

SendEmail is an implementation of Backend.SendEmail. It renders the template and sends the email immediately via SMTP.

(templateType, from string, to []string, data interface{})

Source from the content-addressed store, hash-verified

100// SendEmail is an implementation of Backend.SendEmail.
101// It renders the template and sends the email immediately via SMTP.
102func (b *DefaultBackend) SendEmail(templateType, from string, to []string, data interface{}) error {
103 subject, body, err := b.Templates.Execute(templateType, EmailKindText, data)
104 if err != nil {
105 return errors.Wrap(err, "executing template")
106 }
107
108 return b.queue(subject, from, to, EmailKindText, body)
109}
110
111// queue sends the email immediately via SMTP.
112func (b *DefaultBackend) queue(subject, from string, to []string, contentType, body string) error {

Callers 1

Calls 2

queueMethod · 0.95
ExecuteMethod · 0.65

Tested by 1