email

package
v0.0.0-...-ddfd2c2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 15 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 {
	Filename  string // filename
	Data      []byte // attachment data
	Inline    bool   // is inline
	ContentId string // content id
}

Attachment 邮件附件

type Header struct {
	Key   string
	Value string
}

Header 一个额外的邮件头

type Message

type Message struct {
	To      []*mail.Address
	Cc      []*mail.Address
	Bcc     []*mail.Address
	ReplyTo string
	Subject string

	Body        string
	BodyType    string
	Headers     []Header
	Attachments map[string]*Attachment
	// contains filtered or unexported fields
}

Message SMTP 消息

func HTMLMessage

func HTMLMessage(subject string, body string) *Message

HTMLMessage returns a new Message that can compose an HTML email with attachments

func TextMessage

func TextMessage(subject string, body string) *Message

TextMessage returns a new Message that can compose an email with attachments

func (*Message) AddBCC

func (m *Message) AddBCC(address *mail.Address) []*mail.Address

AddBCC 添加一个密送收件人

func (*Message) AddCC

func (m *Message) AddCC(address *mail.Address) []*mail.Address

AddCC 添加一个抄送收件人

func (*Message) AddHeader

func (m *Message) AddHeader(key string, value string) Header

AddHeader 添加一个消息头

func (*Message) AddTO

func (m *Message) AddTO(address *mail.Address) []*mail.Address

AddTO 添加一个收件人

func (*Message) Attach

func (m *Message) Attach(file string) error

Attach 添加一个文件作为附件

func (*Message) AttachBuffer

func (m *Message) AttachBuffer(filename string, buf []byte, inline bool, cid string)

AttachBuffer 添加一个二进制的附件

func (*Message) Inline

func (m *Message) Inline(file string, cid string) error

Inline 添加一个文件作为内联附件

func (*Message) Send

func (m *Message) Send() error

通过 SMTP 协议发送邮件

func (*Message) SendWithMta

func (m *Message) SendWithMta(mta *db.MTA) error

通过指定代理发送邮件

Jump to

Keyboard shortcuts

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