mailer

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	SMTPHost     string
	SMTPPort     string
	SMTPUser     string
	SMTPPass     string
	From         string
	To           []string
	Subject      string
	Body         string
	IsHTML       bool          // 是否为HTML正文
	InlineImages []InlineImage // 内嵌图片
	UseTLS       bool          // 是否使用TLS
	CertFile     string        // 证书文件路径
	KeyFile      string        // 私钥文件路径
	CAFile       string        // CA证书文件路径(可选)
}

Email 结构体定义了邮件的基本属性

func New

func New(conf jcbaseGo.MailerStruct) *Email

New 创建一个新的Email实例

func (*Email) AddInlineImage

func (e *Email) AddInlineImage(cid, base64Data string)

AddInlineImage 添加内嵌图片

func (*Email) AddRecipient

func (e *Email) AddRecipient(to string)

AddRecipient 添加收件人地址

func (*Email) Send

func (e *Email) Send() error

Send 发送邮件

func (*Email) SetBody

func (e *Email) SetBody(body string, isHTML bool)

SetBody 设置邮件正文

func (*Email) SetSubject

func (e *Email) SetSubject(subject string)

SetSubject 设置邮件主题

type InlineImage

type InlineImage struct {
	CID  string // 内容ID,用于在HTML中引用
	Data string // Base64编码的图片数据
}

InlineImage 结构体定义了内嵌图片的基本属性

Jump to

Keyboard shortcuts

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