Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilMailer = errors.New("no mailer instance")
ErrNilMailer specifies nil mailer instance error.
var ErrNoFrom = errors.New("from option missing")
Functions ¶
func SendMail ¶
SendMail sends mail to given recipients with specified subject and plaintext and HTML message (that's why function requires both). If plaintext of html message is empty, then that format is not used.
func SetupMailer ¶
func SetupMailer(opts ...MailerOption) (err error)
SetupMailer set ups package mailer with specified parameters.
Types ¶
type Attachment ¶ added in v1.4.0
Attachment struct defines attachment for e-mail.
type Mailer ¶
type Mailer struct {
Host string
Port string
Name string
From string
Creds gosasl.Client
Localizer *i18n.Localizer
ReturnPath string
}
Mailer struct definition.
func NewMailer ¶
func NewMailer(opts ...MailerOption) (*Mailer, error)
NewMailer creates new mailer instance. If we can't create new mailer than error is returned.
func (*Mailer) SendMail ¶
func (m *Mailer) SendMail(recipients []string, subject, plain, html string, attachments []Attachment) (errs []error)
SendMail sends mail to given recipients with specified subject and plaintext and HTML message (that's why function requires both). If plaintext of html message is empty, then that format is not used.
type MailerOption ¶
type MailerOption func(*MailerOptions)
func WithCredentials ¶
func WithCredentials(username, password string) MailerOption
func WithFrom ¶
func WithFrom(from string) MailerOption
func WithHost ¶
func WithHost(host string) MailerOption
func WithName ¶
func WithName(name string) MailerOption
func WithPort ¶
func WithPort(port string) MailerOption
func WithReturnPath ¶ added in v1.1.0
func WithReturnPath(returnPath string) MailerOption