Documentation
¶
Index ¶
- Variables
- func IsDummyMode(ctx context.Context) bool
- func WithDummyMode(ctx context.Context) context.Context
- type Config
- type DummyMailServer
- func (d *DummyMailServer) APIKeys() []string
- func (d *DummyMailServer) Addresses(apiKey string) []string
- func (d *DummyMailServer) Inbox(apiKey string, address string) []*Message
- func (d *DummyMailServer) LastMessageInInbox(apiKey string, address string) *Message
- func (d *DummyMailServer) LastMessageInOutbox(apiKey string, address string) *Message
- func (d *DummyMailServer) Outbox(apiKey string, address string) []*Message
- func (d *DummyMailServer) Send(apiKey string, message Message) error
- type Mailer
- type Message
- type Option
- type Type
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidType = errors.New("invalid mailer type")
ErrInvalidType is returned when an invalid mailer type is provided.
Functions ¶
func IsDummyMode ¶
IsDummyMode returns true if dummy mode is enabled.
Types ¶
type Config ¶
type Config struct {
APIKey string // The API key for the mailer.
Domain string // The domain for the mailer (only used for Mailgun).
Retry bool // Whether to retry sending the mail.
BackoffOptions []backoff.RetryOption // The backoff options for the mailer. If Retry is true, then these options will be used to retry the send.
}
Config is the configuration for the mailer.
type DummyMailServer ¶
type DummyMailServer struct {
// contains filtered or unexported fields
}
DummyMailServer is our "dummy" mail server. It is indexed by the API key and contains a list of messages in ascending time order.
func Dummy ¶
func Dummy() *DummyMailServer
Dummy returns the dummy mail server.
This is a singleton instance of the dummy mail server.
func (*DummyMailServer) APIKeys ¶ added in v0.1.1
func (d *DummyMailServer) APIKeys() []string
APIKeys returns the API keys used by the dummy mail server so far.
func (*DummyMailServer) Addresses ¶ added in v0.1.1
func (d *DummyMailServer) Addresses(apiKey string) []string
Addresses returns the list of e-mail addresses available for the given API key.
func (*DummyMailServer) Inbox ¶
func (d *DummyMailServer) Inbox(apiKey string, address string) []*Message
Inbox returns the messages in the inbox for the given API key and address.
func (*DummyMailServer) LastMessageInInbox ¶
func (d *DummyMailServer) LastMessageInInbox(apiKey string, address string) *Message
LastMessageInInbox returns the last message in the inbox for the given API key and address. If there are no messages in the inbox, it returns nil.
func (*DummyMailServer) LastMessageInOutbox ¶
func (d *DummyMailServer) LastMessageInOutbox(apiKey string, address string) *Message
LastMessageInOutbox returns the last message in the outbox for the given API key and address. If there are no messages in the outbox, it returns nil.
type Mailer ¶
type Mailer struct {
// contains filtered or unexported fields
}
Mailer is the mailer client.
type Message ¶
type Message struct {
From mail.Address
To mail.Address
Subject string
BodyPlainText string
BodyHTML string
}
Message is a piece of mail.
type Option ¶
type Option func(*Config)
Option can be used to configure the mailer.
func WithConfig ¶
WithConfig sets the configuration for the mailer.
This fully replaces the existing configuration.