smtp

package
v0.1.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Red   string = "#e20b0b"
	Green string = "#23ba47"
	Grey  string = "#a4a8b1"
	Text  string = "text"
)

Variables

View Source
var Init = func(fields map[string]interface{}) error {
	smtpconfig = new(Configuration)
	smtpconfig = utils.SetFields(smtpconfig, fields).(*Configuration)
	return nil
}
View Source
var Notify = func(log utils.LogLine) error {
	if smtpconfig.HostPort == "" {
		return errors.New("wrong config")
	}

	payload, err := NewPayload(log)
	if err != nil {
		return err
	}
	err = Send(payload)
	if err != nil {
		return err
	}
	return nil
}

Functions

func Send

func Send(payload Payload) error

Types

type Configuration

type Configuration struct {
	HostPort string `field:"hostport"`
	User     string `field:"user"`
	Password string `field:"password"`
	From     string `field:"from"`
	To       string `field:"to"`
	Format   string `field:"format" default:"html"`
	TLS      bool   `field:"tls" default:"false"`
}

type Payload

type Payload struct {
	From    string
	To      string
	Subject string
	Body    string
	Mime    string
	Date    string
}

Payload

func NewPayload

func NewPayload(log utils.LogLine) (Payload, error)

Jump to

Keyboard shortcuts

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