Documentation
¶
Overview ¶
Package emailszh: Emails sending package with Chinese-intuitive naming conventions Provides intuitive interfaces supporting two-language identifiers (English prefix + Chinese suffix) Enables simple emails operations with sending, receiving, and message building Designed with ease of use in mind via readable naming patterns and comprehensive documentation
emailszh: 采用中文直观命名的邮件发送包 提供直观的接口,支持双语标识符(英文前缀 + 中文后缀) 通过发送、接收和消息构建实现便捷的邮件操作 通过可读的命名模式和全面的文档提升使用便捷性
Index ¶
- func New邮件(s标题 string, c内容 *C邮件内容, t目标 *T收件目标) *gomail.Message
- type C邮件内容
- type O邮件构建器
- func (op *O邮件构建器) Get邮件() *gomail.Message
- func (op *O邮件构建器) Set内容(c内容 *C邮件内容) *O邮件构建器
- func (op *O邮件构建器) Set发送者(s发送者 *S发送者) *O邮件构建器
- func (op *O邮件构建器) Set密送至(s接收者s R接收者s) *O邮件构建器
- func (op *O邮件构建器) Set抄送至(s接收者s R接收者s) *O邮件构建器
- func (op *O邮件构建器) Set接收者(r接收者 *R接收者) *O邮件构建器
- func (op *O邮件构建器) Set标题(s标题 string) *O邮件构建器
- func (op *O邮件构建器) Set目标(t目标 *T收件目标) *O邮件构建器
- func (op *O邮件构建器) Set附件(s附件路径 string, settings ...gomail.FileSetting) *O邮件构建器
- type R接收者
- type R接收者s
- type S发送者
- type S发送者s
- type T收件目标
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type C邮件内容 ¶
type C邮件内容 struct {
M类型 string // Content MIME type (text/html or text/plain) // 内容 MIME 类型(text/html 或 text/plain)
B正文 string // Message content text // 消息正文文本
S设置 []gomail.PartSetting // Part settings in message formatting // 消息格式化的部分设置
}
C邮件内容 represents emails message content configuration Contains content type, text/HTML content, and formatting settings Supports both plain text and HTML formatted messages
C邮件内容 代表邮件消息内容配置 包含内容类型、文本/HTML 内容和格式设置 支持纯文本和 HTML 格式的消息
type O邮件构建器 ¶
type O邮件构建器 struct {
// contains filtered or unexported fields
}
O邮件构建器 represents emails message construction with method chaining pattern Enables fluent interface configuration of emails message properties Supports sending, recipients, subject, content, and attachments configuration
O邮件构建器 代表采用方法链模式的邮件构建 通过流畅接口配置邮件消息属性 支持发送、收件者、主题、正文和附件配置
func New构建器 ¶
New构建器 creates construction instance from existing gomail message Enables wrapping existing messages with construction interface Returns construction instance with wrapped message
New构建器 从现有 gomail 消息创建构建实例 使构建接口能够包装现有消息 返回带有包装消息的构建实例
func New邮件构建器 ¶
func New邮件构建器() *O邮件构建器
New邮件构建器 creates new emails construction instance with fresh message Returns instance that can configure emails properties
New邮件构建器 创建新的邮件构建实例,带有新消息 返回可配置邮件属性的实例
func (*O邮件构建器) Get邮件 ¶
Get邮件 retrieves the underlying gomail message Returns configured message that can be sent
Get邮件 获取底层的 gomail 消息 返回配置好的消息,可以发送
func (*O邮件构建器) Set内容 ¶
Set内容 configures emails content with type and settings Supports both plain text and HTML content types Returns instance with support of method chaining
Set内容 配置邮件内容及其类型和设置 支持纯文本和 HTML 内容类型 返回实例以支持方法链
func (*O邮件构建器) Set发送者 ¶
Set发送者 configures emails sending information Sets both sending address and shown name Returns instance with support of method chaining
Set发送者 配置邮件发送信息 设置发送地址和显示名称 返回实例以支持方法链
func (*O邮件构建器) Set密送至 ¶
Set密送至 configures blind-cc recipient list Returns instance with support of method chaining
Set密送至 配置密送收件者列表 返回实例以支持方法链
func (*O邮件构建器) Set抄送至 ¶
Set抄送至 configures carbon-cc recipient list Returns instance with support of method chaining
Set抄送至 配置抄送收件者列表 返回实例以支持方法链
func (*O邮件构建器) Set接收者 ¶
Set接收者 configures emails recipient information Sets main recipient address and shown name Returns instance with support of method chaining
Set接收者 配置邮件接收者信息 设置主要收件者地址和显示名称 返回实例以支持方法链
func (*O邮件构建器) Set标题 ¶
Set标题 configures emails subject line Returns instance with support of method chaining
Set标题 配置邮件主题行 返回实例以支持方法链
type R接收者 ¶
type R接收者 struct {
M邮箱 string // Receiver mailbox address // 接收者邮箱地址
N昵称 string // Receiver display name // 接收者显示名称
}
R接收者 represents emails receiving information Contains recipient address and shown name
R接收者 代表邮件接收信息 包含收件地址和显示名称
type S发送者 ¶
type S发送者 struct {
M邮箱 string `json:"mailbox"` // Sender mailbox address // 发送者邮箱地址
N昵称 string `json:"nickname"` // Sender display name // 发送者显示名称
H主机 string `json:"smtp_host"` // SMTP server hostname // SMTP 服务器主机名
P端口 int `json:"smtp_port"` // SMTP server port // SMTP 服务器端口
U账号 string `json:"username"` // SMTP account username (same as address in many cases) // SMTP 账户用户名(通常与地址相同)
P密码 string `json:"password"` // SMTP account password // SMTP 账户密码
}
S发送者 represents emails sending configuration with SMTP settings Contains required information including credentials and SMTP settings Note: SMTP default port is 25, but encrypted connections (SSL/TLS) use port 465/994 Ensure the emails client is configured with the correct port and encryption
S发送者 代表带有 SMTP 设置的邮件发送配置 包含必需信息,包括凭证和 SMTP 设置 注意:SMTP 默认端口是 25,但加密连接(SSL/TLS)使用端口 465/994 确保邮件客户端配置正确的端口和加密方式
func (*S发送者) Act发邮件 ¶
Act发邮件 sends emails message using configured SMTP settings Act means "action", acts as Sen发邮件 alias
Act发邮件 使用配置的 SMTP 设置发送邮件消息 Act 取自英文 action(动作),作为 Sen发邮件 的别名
func (*S发送者) Get拨号器 ¶
Get拨号器 creates and returns an SMTP dialer with sending configuration Returns configured dialer that can establish SMTP connections
Get拨号器 使用发送配置创建并返回 SMTP 拨号器 返回配置好的拨号器,可建立 SMTP 连接
type T收件目标 ¶
type T收件目标 struct {
R接收者 *R接收者 // Main recipient (To) // 主要收件者(To)
R抄送者s R接收者s // Carbon-cc recipients (Cc) // 抄送收件者(Cc)
R密送者s R接收者s // Blind-cc recipients (Bcc) // 密送收件者(Bcc)
}
T收件目标 represents complete emails targeting configuration Contains main recipient, carbon-cc recipients, and blind-cc recipients Supports various emails distribution patterns
T收件目标 代表完整的邮件目标配置 包含主要收件者、抄送收件者和密送收件者 支持多种邮件分发模式
func New收件目标 ¶
New收件目标 creates complete emails targeting with recipient types Supports main recipient, carbon-cc list, and blind-cc list Returns configured target with recipient information
New收件目标 创建完整邮件目标及收件者类型 支持主要收件者、抄送列表和密送列表 返回配置好的目标,包含收件者信息
func New目标单收件 ¶
New目标单收件 creates emails target with single main recipient Returns target with one main recipient and blank Cc/Bcc lists
New目标单收件 创建包含单个主要收件者的邮件目标 返回包含一个主要收件者和空白 Cc/Bcc 列表的目标
func New目标单收件和密送 ¶
New目标单收件和密送 creates emails target with main recipient and blind-cc list Returns target with one main recipient and multiple Bcc recipients
New目标单收件和密送 创建包含主要收件者和密送列表的邮件目标 返回包含一个主要收件者和多个密送收件者的目标
func New目标首个收件其余密送 ¶
New目标首个收件其余密送 creates emails target with first as main and remaining as Bcc Uses first element as main recipient and rest as blind-cc recipients Returns nil with warning if the list is blank
New目标首个收件其余密送 创建以首个接收者作为主收件者、其余作为密送的目标 使用第一个元素作为主要收件者,其余作为密送收件者 如果列表为空则返回 nil 并发出警告