smtp

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Smtp

type Smtp struct {
	ModuleName  string            `mapstructure:"module-name" yaml:"module-name" json:"moduleName"`    // 模块名称
	Enabled     bool              `mapstructure:"enabled" yaml:"enabled" json:"enabled"`               // 是否启用
	SMTPHost    string            `mapstructure:"smtp-host" yaml:"smtp-host" json:"smtpHost"`          // SMTP主机
	SMTPPort    int               `mapstructure:"smtp-port" yaml:"smtp-port" json:"smtpPort"`          // SMTP端口
	Username    string            `mapstructure:"username" yaml:"username" json:"username"`            // 用户名
	Password    string            `mapstructure:"password" yaml:"password" json:"password"`            // 密码
	FromAddress string            `mapstructure:"from-address" yaml:"from-address" json:"fromAddress"` // 发件人地址
	ToAddresses []string          `mapstructure:"to-addresses" yaml:"to-addresses" json:"toAddresses"` // 收件人地址列表
	EnableTLS   bool              `mapstructure:"enable-tls" yaml:"enable-tls" json:"enableTls"`       // 是否启用TLS
	Headers     map[string]string `mapstructure:"headers" yaml:"headers" json:"headers"`               // 自定义头部
	PoolSize    int               `mapstructure:"pool-size" yaml:"pool-size" json:"poolSize"`          // 连接池大小
}

Smtp 邮箱配置

func Default

func Default() *Smtp

Default 创建默认邮箱配置

func (*Smtp) AddHeader

func (e *Smtp) AddHeader(key, value string) *Smtp

AddHeader 添加自定义头部

func (*Smtp) AddToAddress

func (e *Smtp) AddToAddress(address string) *Smtp

AddToAddress 添加收件人地址

func (*Smtp) Clone

func (e *Smtp) Clone() internal.Configurable

Clone 返回配置的副本

func (*Smtp) DisableTLS

func (e *Smtp) DisableTLS() *Smtp

DisableTLS 禁用TLS

func (*Smtp) EnableTLSService

func (e *Smtp) EnableTLSService() *Smtp

EnableTLSService 启用TLS

func (*Smtp) Get

func (e *Smtp) Get() interface{}

Get 返回配置接口

func (*Smtp) Set

func (e *Smtp) Set(data interface{})

Set 设置配置数据

func (*Smtp) Validate

func (e *Smtp) Validate() error

Validate 验证配置

func (*Smtp) WithEnabled

func (e *Smtp) WithEnabled(enabled bool) *Smtp

WithEnabled 设置是否启用

func (*Smtp) WithFromAddress

func (e *Smtp) WithFromAddress(address string) *Smtp

WithFromAddress 设置发件人地址

func (*Smtp) WithModuleName

func (e *Smtp) WithModuleName(name string) *Smtp

WithModuleName 设置模块名称

func (*Smtp) WithPassword

func (e *Smtp) WithPassword(password string) *Smtp

WithPassword 设置密码

func (*Smtp) WithPoolSize

func (e *Smtp) WithPoolSize(size int) *Smtp

WithPoolSize 设置连接池大小

func (*Smtp) WithSMTPHost

func (e *Smtp) WithSMTPHost(host string) *Smtp

WithSMTPHost 设置SMTP主机

func (*Smtp) WithSMTPPort

func (e *Smtp) WithSMTPPort(port int) *Smtp

WithSMTPPort 设置SMTP端口

func (*Smtp) WithUsername

func (e *Smtp) WithUsername(username string) *Smtp

WithUsername 设置用户名

Jump to

Keyboard shortcuts

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