Versions in this module Expand all Collapse all v0 v0.0.1 Feb 29, 2020 Changes in this version + var ErrUnconfiguredCarrier = errors.New("unconfigured carrier") + func RecipientsHeader(recipients []mail.Address) string + type AttachOption func(*attachConfig) + func ContentType(contentType string) AttachOption + type Attachment struct + Content []byte + Filename string + Header textproto.MIMEHeader + type Carrier interface + Send func(context.Context, *Letter) error + type CarrierFactory interface + CreateCarrier func(ctx context.Context, cfg map[string]interface{}) (Carrier, error) + type CarrierFactoryConfig struct + Config map[string]interface{} + Provider string + type CarrierFactoryFunc func(context.Context, map[string]interface{}) (Carrier, error) + func (fn CarrierFactoryFunc) CreateCarrier(ctx context.Context, cfg map[string]interface{}) (Carrier, error) + type Config struct + Carriers map[string]CarrierFactoryConfig + Creators map[string]CarrierFactory + DefaultCarrier string + func NewConfig(options ...ConfigOption) *Config + func (cfg *Config) Configure(name, provider string, config map[string]interface{}) + func (cfg *Config) Load(path string) error + func (cfg *Config) LoadYAML(path string) error + func (cfg *Config) LoadYAMLReader(r io.Reader) error + func (cfg *Config) NewOffice(ctx context.Context) (*PostOffice, error) + func (cfg *Config) RegisterFactory(name string, creator CarrierFactory) + type ConfigOption func(*Config) + type ConfigureOption func(*configureConfig) + func Default() ConfigureOption + type DuplicateCarrierConfigError struct + Name string + func (err DuplicateCarrierConfigError) Error() string + type InvalidConfigValueError struct + CarrierName string + ConfigKey string + Expected interface{} + Provided interface{} + func (err InvalidConfigValueError) Error() string + type Letter struct + Attachments []Attachment + BCC []mail.Address + CC []mail.Address + From mail.Address + HTML string + Subject string + Text string + To []mail.Address + func Write(options ...WriteOption) (*Letter, error) + func (let *Letter) Attach(r io.Reader, filename string, options ...AttachOption) (Attachment, error) + func (let *Letter) AttachFile(path, filename string, options ...AttachOption) (Attachment, error) + func (let *Letter) RFC() string + func (let *Letter) String() string + type PostOffice struct + func New() *PostOffice + func (o *PostOffice) Carrier(name string) (Carrier, error) + func (o *PostOffice) Configure(name string, c Carrier, options ...ConfigureOption) + func (o *PostOffice) Default() (Carrier, error) + func (o *PostOffice) Send(ctx context.Context, options ...WriteOption) error + func (o *PostOffice) SendLetter(ctx context.Context, let *Letter) error + func (o *PostOffice) SendLetterWith(ctx context.Context, name string, let *Letter) error + func (o *PostOffice) SendWith(ctx context.Context, name string, options ...WriteOption) error + func (o *PostOffice) SetDefault(name string) error + type UnregisteredProviderError struct + Provider string + func (err UnregisteredProviderError) Error() string + type WriteOption func(*Letter) error + func Attach(r io.Reader, filename string, options ...AttachOption) WriteOption + func AttachFile(path, filename string, options ...AttachOption) WriteOption + func BCC(recipients ...mail.Address) WriteOption + func CC(recipients ...mail.Address) WriteOption + func From(sender mail.Address) WriteOption + func HTML(html string) WriteOption + func Subject(subject string) WriteOption + func Text(text string) WriteOption + func To(recipients ...mail.Address) WriteOption