moves claims into models
This commit is contained in:
parent
38722c9da5
commit
f1c2249744
6 changed files with 57 additions and 35 deletions
|
|
@ -13,7 +13,7 @@ type ContentLoginToken struct {
|
|||
|
||||
// LoginToken creates and sends a login token email with provided template content.
|
||||
func (m *Mailer) LoginToken(name, address string, content ContentLoginToken) error {
|
||||
msg := &Mail{
|
||||
msg := &message{
|
||||
from: NewEmail(m.fromName, m.from),
|
||||
to: NewEmail(name, address),
|
||||
subject: "Login Token",
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ func NewMailer() (*Mailer, error) {
|
|||
}
|
||||
|
||||
// Send parses the corrsponding template and sends the mail via smtp.
|
||||
func (m *Mailer) Send(mail *Mail) error {
|
||||
func (m *Mailer) Send(mail *message) error {
|
||||
buf := new(bytes.Buffer)
|
||||
if err := m.templates.ExecuteTemplate(buf, mail.template, mail.content); err != nil {
|
||||
return err
|
||||
|
|
@ -95,8 +95,8 @@ func (m *Mailer) Send(mail *Mail) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Mail struct holds all parts of a specific email.
|
||||
type Mail struct {
|
||||
// message struct holds all parts of a specific email message.
|
||||
type message struct {
|
||||
from *Email
|
||||
to *Email
|
||||
subject string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue