email

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	TypeNone = ""
	TypeSMTP = "smtp"
)

service provider types

View Source
const (
	AuthTypePlain   = "plain"
	AuthTypeCRAMMD5 = "crammd5"
)

authentication options

View Source
const (
	PluginEmail = "email"
)

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, rawCfg *handlerTY.Config) (handlerTY.Plugin, error)

email client

Types

type Client

type Client interface {
	Name() string
	Start() error
	Close() error
	Post(variables map[string]interface{}) error
	State() *types.State
	Send(from string, to []string, subject, body string) error
}

Client for email service

func NewSMTPClient

func NewSMTPClient(ctx context.Context, logger *zap.Logger, handlerCfg *handlerTY.Config, cfg *Config) (Client, error)

init smtp client

type Config

type Config struct {
	Type      string
	Host      string
	Port      int
	AuthType  string
	Username  string
	Password  string `json:"-" yaml:"-"`
	FromEmail string
	ToEmails  string // comma separated
	Insecure  bool
}

Config of email service

type SmtpClient

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

smtp client

func (*SmtpClient) Close

func (sc *SmtpClient) Close() error

Close func implementation

func (*SmtpClient) Name

func (sc *SmtpClient) Name() string

func (*SmtpClient) Post

func (sc *SmtpClient) Post(parameters map[string]interface{}) error

Post performs send operation

func (*SmtpClient) Send

func (sc *SmtpClient) Send(from string, to []string, subject, body string) error

Send func implementation

func (*SmtpClient) Start

func (sc *SmtpClient) Start() error

func (*SmtpClient) State

func (sc *SmtpClient) State() *types.State

Jump to

Keyboard shortcuts

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