mail

package
v0.0.0-...-5c8b849 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mail provides a light wrapper around SMTP functionality.

Index

Constants

This section is empty.

Variables

View Source
var ErrRecipientUnsubscribed = errors.New("recipient has requested no email communication")

Functions

func NewModelList

func NewModelList(m *model.Manager, key string) (*modelList, error)

Types

type Config

type Config struct {
	SMTPAddress  string `toml:"smtp_address"`
	SMTPUsername string `toml:"smtp_username"`
	SMTPPassword string `toml:"smtp_password"`

	System Recipient `toml:"system"` // The system's address.
}

Config describes a Sender's configuration.

type List

type List interface {
	Add(Recipient) error
	Exists(Recipient) bool
}

type Recipient

type Recipient struct {
	Name  string `toml:"name"`
	Email string `toml:"email"`
}

A Recipient is an email recipient.

func (Recipient) String

func (r Recipient) String() string

type Sender

type Sender struct {
	DoNotSend List
	// contains filtered or unexported fields
}

A Sender handles sending of email.

func NewSender

func NewSender(conf Config, l log.Logger) *Sender

NewSender creates a new Sender, ready for use.

func (*Sender) Send

func (s *Sender) Send(recipient Recipient, subject, message string) error

Send sends an email with the given HTML message to the recipient.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL