email

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

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