email

package
v0.2.38 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Data        []byte `json:"data"`        //文件二进制
	Name        string `json:"name"`        //文件名
	ContentType string `json:"contentType"` //附件编码类型,比如:multipart/related;boundary=GoBoundary
}

附件

func (*Attachment) String

func (e *Attachment) String() string

String

type Email

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

* 邮件类 基类 *

func (*Email) Send

func (e *Email) Send(to, subject, body string) error

发送邮件

func (*Email) SendTLS

func (e *Email) SendTLS(to, subject, body string) error

发送邮件

func (*Email) SendTLSs added in v0.0.91

func (e *Email) SendTLSs(to []string, subject, body string) error

发送邮件

func (*Email) Sends added in v0.0.91

func (e *Email) Sends(to []string, subject, body string) error

发送邮件

func (*Email) WithAppendByPath

func (e *Email) WithAppendByPath(path string) Emailer

WithAppendByPath 添加附件

func (*Email) WithAppendBytes

func (e *Email) WithAppendBytes(name string, data []byte) Emailer

WithAppendBytes 添加附件

type EmailConfig

type EmailConfig struct {
	User     string `json:"user"`     //邮箱账号
	Password string `json:"password"` //邮箱密码
	Host     string `json:"host"`     //邮箱服务器地址
	Port     string `json:"port"`     //邮箱服务器端口号
}

邮件配置

func (*EmailConfig) String

func (e *EmailConfig) String() string

String

type Emailer

type Emailer interface {
	Send(to, subject, body string) error
	Sends(to []string, subject, body string) error
	SendTLS(to, subject, body string) error
	SendTLSs(to []string, subject, body string) error
	WithAppendByPath(path string) Emailer
	WithAppendBytes(name string, data []byte) Emailer
}

* 邮件类接口 *

func WithConfig

func WithConfig(config EmailConfig) Emailer

初始化邮件配置

type Message

type Message struct {
	From        string       `json:"from"`        //发送邮箱
	To          []string     `json:"to"`          //接收邮箱
	Cc          []string     `json:"cc"`          //抄送邮箱
	Bcc         []string     `json:"bcc"`         //暗抄送邮箱
	Subject     string       `json:"subject"`     //邮件主题
	Body        string       `json:"body"`        //邮件内容
	PlainText   string       `json:"plainText"`   //纯文本内容
	ContentType string       `json:"contentType"` //邮件内容编码
	Attachment  []Attachment `json:"attachment"`  //附件
}

邮件消息

func (*Message) String

func (m *Message) String() string

String

Jump to

Keyboard shortcuts

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