mail

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config func(*option)

Config 邮件主要配置

func WithConfig

func WithConfig(host string, port int, transport, username, password, fromUser, fromName string) Config

WithConfig 设置邮件主要配置 @param host string 邮件提供商发送地址 @param port int 邮件提供商发送端口 @param transport string 邮件提供商发送协议 @param username string 邮件提供商用户名 @param password string 邮件提供商用户密码 @param fromUser string 发送者邮箱地址 @param fromName string 发送者名称

type Mail

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

Mail 邮件发送器

func NewMailSender

func NewMailSender(to []string, template string, config Config, opts ...Option) (*Mail, error)

NewMailSender 新建邮件发送器 to []string 接收者邮箱地址列表 template 邮件模板 config Config 邮件配置 opts []Option 邮件额外选项

func (*Mail) SendMail

func (sender *Mail) SendMail() error

SendMail 发送邮件

type Option

type Option func(*option)

Option 邮件额外配置

func WithAttach

func WithAttach(filename, attachName string) Option

WithAttach 添加邮件附件 @param filename string 附件文件地址 @param attachName string 附件名称

func WithParams

func WithParams(params map[string]string) Option

WithParams 添加邮件参数 @param params map[string]string 参数列表

func WithSubject

func WithSubject(subject string) Option

WithSubject 添加邮件主题 @param subject string 邮件主题

type Sender

type Sender interface {
	// SendMail 发送邮件
	SendMail() error
}

Sender 邮件发送器接口

Jump to

Keyboard shortcuts

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