Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeliveryType ¶
type DeliveryType string
DeliveryType is a delivery type.
const DeliverySMTP DeliveryType = "smtp"
DeliverySMTP is an SMTP delivery type.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is an HTTP handler that receives messages over HTTP and sends them to configured deliveries.
func NewHandler ¶
func NewHandler(targets TargetsConfig, senders map[DeliveryType]Sender) (*Handler, error)
NewHandler returns a new instance of Handler.
type Message ¶
Message is a message received in an HTTP request for transferring to delivery service.
type SMTPConfig ¶
type SMTPConfig struct { Host string `envconfig:"host" required:"true" desc:"a host of an SMTP relay"` Port int `envconfig:"port" default:"587" desc:"a port of an SMTP relay"` From string `envconfig:"from" desc:"a sender email address"` Retries []time.Duration `envconfig:"retries" default:"10s,1m,10m" desc:"intervals to retry email sending"` }
SMTPConfig is configuration for SMTP Relay connection.
type SMTPSender ¶
type SMTPSender struct { SMTPConfig // contains filtered or unexported fields }
SMTPSender is a message sender that sends a message by SMTP.
func NewSMTPSender ¶
func NewSMTPSender(cnf SMTPConfig) *SMTPSender
NewSMTPSender returns a new SMTPSender.
type TargetsConfig ¶
type TargetsConfig struct {
// contains filtered or unexported fields
}
TargetsConfig is a configuration of routing messages to targets.
func (*TargetsConfig) Decode ¶
func (cnf *TargetsConfig) Decode(value string) error
Decode decodes a string in the format "target1:delivery1:recipient1,target2:delivery2:recipient2" to TargetsConfig.
func (TargetsConfig) MarshalJSON ¶
func (cnf TargetsConfig) MarshalJSON() ([]byte, error)
MarshalJSON serializes TargetsConfig to a string in the format "target1:delivery1:recipient1,target2:delivery2:recipient2". It is needed for the correct output in logs.