email

package
v0.0.0-...-34056af Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTemplate = filepath.Join("..", "template", "email.tmpl")
)
View Source
var (
	// TencentEnterpriseSMTPServer 腾讯企业邮箱服务器
	TencentEnterpriseSMTPServer = EmailServer{Host: "smtp.exmail.qq.com", Port: 465, Ssl: true}
)

Functions

This section is empty.

Types

type Email

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

Email implements a Notifier for email notifications.

func New

func New(c *EmailConfig, l *zap.Logger) *Email

New create Email instance.

func (*Email) Notify

func (e *Email) Notify(ctx context.Context) error

Notify send an email

func (*Email) Type

func (e *Email) Type() string

Type the type of a Notifier

type EmailConfig

type EmailConfig struct {
	From         string                 `yaml:"from,omitempty" json:"from,omitempty"`                   // 发件人
	To           string                 `yaml:"to,omitempty" json:"to,omitempty"`                       // 收件人
	Cc           string                 `yaml:"cc,omitempty" json:"cc,omitempty"`                       // 抄送人
	Bcc          string                 `yaml:"bcc,omitempty" json:"bcc,omitempty"`                     // 密送人
	EmailServer  EmailServer            `yaml:"email_server,omitempty" json:"email_server,omitempty"`   // 邮箱服务器
	AuthUsername string                 `yaml:"auth_username,omitempty" json:"auth_username,omitempty"` // 邮箱账号
	AuthPassword Secret                 `yaml:"auth_password,omitempty" json:"auth_password,omitempty"` // 邮箱密码
	AuthSecret   Secret                 `yaml:"auth_secret,omitempty" json:"auth_secret,omitempty"`     // 邮箱
	Subject      string                 `yaml:"subject,omitempty" json:"subject"`                       // 主题
	Template     string                 `yaml:"tempalte,omitempty" json:"tempalte,omitempty"`           // 模板字符串
	TemplateFile string                 `yaml:"template_file,omitempty" json:"template_file,omitempty"` // 模板文件
	Data         map[string]interface{} `yaml:"data" json:"data"`                                       // 内容
}

EmailConfig configures notifications via mail.

type EmailServer

type EmailServer struct {
	Host string
	Port int
	Ssl  bool
}

EmailServer 邮箱服务器

func (*EmailServer) String

func (s *EmailServer) String() string

String return host:port

type Secret

type Secret string

Jump to

Keyboard shortcuts

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