1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-02-03 13:21:22 +02:00
authboss/mailer.go
2018-01-29 13:14:55 -08:00

31 lines
809 B
Go

package authboss
import (
"context"
)
// SendMail uses the currently configured mailer to deliver e-mails.
func (a *Authboss) SendMail(ctx context.Context, data Email) error {
return a.Mailer.Send(ctx, data)
}
// Mailer is a type that is capable of sending an e-mail.
type Mailer interface {
Send(context.Context, Email) error
}
// Email all the things. The ToNames and friends are parallel arrays and must
// be 0-length or the same length as their counterpart. To omit a name
// for a user at an index in To simply use an empty string at that
// index in ToNames.
type Email struct {
To, Cc, Bcc []string
ToNames, CcNames, BccNames []string
FromName, From string
ReplyToName, ReplyTo string
Subject string
TextBody string
HTMLBody string
}