smtp

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRecipients = errors.New("not sending email, no recipients defined")

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled  bool   `toml:"enabled" override:"enabled"`
	Host     string `toml:"host" override:"host"`
	Port     int    `toml:"port" override:"port"`
	Username string `toml:"username" override:"username"`
	Password string `toml:"password" override:"password,redact"`
	// Whether to skip TLS verify.
	NoVerify bool `toml:"no-verify" override:"no-verify"`
	// Whether all alerts should trigger an email.
	Global bool `toml:"global" override:"global"`
	// Whether all alerts should automatically use stateChangesOnly mode.
	// Only applies if global is also set.
	StateChangesOnly bool `toml:"state-changes-only" override:"state-changes-only"`
	// From address
	From string `toml:"from" override:"from"`
	// Default To addresses
	To []string `toml:"to" override:"to"`
	// Close connection to SMTP server after idle timeout has elapsed
	IdleTimeout toml.Duration `toml:"idle-timeout" override:"idle-timeout"`
}

func NewConfig

func NewConfig() Config

func (Config) Validate added in v1.1.0

func (c Config) Validate() error

type Diagnostic added in v1.4.0

type Diagnostic interface {
	WithContext(ctx ...keyvalue.T) Diagnostic
	Error(msg string, err error)
}

type HandlerConfig added in v1.2.0

type HandlerConfig struct {
	// List of email recipients.
	To []string `mapstructure:"to"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(c Config, d Diagnostic) *Service

func (*Service) Close

func (s *Service) Close() error

func (*Service) Global

func (s *Service) Global() bool

func (*Service) Handler added in v1.2.0

func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) alert.Handler

func (*Service) Open

func (s *Service) Open() error

func (*Service) SendMail

func (s *Service) SendMail(to []string, subject, body string) error

func (*Service) StateChangesOnly added in v0.11.0

func (s *Service) StateChangesOnly() bool

func (*Service) Test added in v1.1.0

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions added in v1.1.0

func (s *Service) TestOptions() interface{}

func (*Service) Update added in v1.1.0

func (s *Service) Update(newConfig []interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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