message

package
v0.0.0-...-95be442 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendMessage

func SendMessage(notice Notice) (bool, error)

SendMessage 发送消息

Types

type DingTalkClient

type DingTalkClient struct {
	RobotURL string
	Message  *DingTalkMessage
}

DingTalkClient 通过钉钉机器人发送消息

func (*DingTalkClient) SendMessage

func (d *DingTalkClient) SendMessage() (bool, error)

SendMessage 通过钉钉机器人发送消息

type DingTalkMessage

type DingTalkMessage struct {
	Message string //消息
	Title   string // markdown标题
	Type    string // 消息类型
}

DingTalkMessage 消息

type EmailClient

type EmailClient struct {
	Host     string
	Port     int
	Username string
	Password string
	Message  *EmailMessage
}

EmailClient 发送客户端

func NewEmailClient

func NewEmailClient(host, username, password string, port int, message *EmailMessage) *EmailClient

NewEmailClient 返回一个邮件客户端 host smtp地址 username 用户名 password 密码 port 端口

func (*EmailClient) SendMessage

func (c *EmailClient) SendMessage() (bool, error)

SendMessage 发送邮件

type EmailMessage

type EmailMessage struct {
	From        string
	To          []string
	Cc          []string
	Subject     string
	ContentType string
	Content     string
	Attach      string
}

EmailMessage 内容

func NewEmailMessage

func NewEmailMessage(from, subject, contentType, content, attach string, to, cc []string) *EmailMessage

NewEmailMessage 返回消息对象 from: 发件人 subject: 标题 contentType: 内容的类型 text/plain text/html attach: 附件 to: 收件人 cc: 抄送人

type Notice

type Notice interface {
	SendMessage() (bool, error)
}

Notice 通知接口

Jump to

Keyboard shortcuts

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