sendEmailAlert

package module
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

sendEmailAlert

通过电子邮件发送文件处理结果

用法

func TestSend(t *testing.T) {
	aim := []string{
		"xxx@example.com",
		"xxx@example.com",
	}
	var info = &Info{
		Form:     "",//发件人地址
		To:       aim,//收件人地址列表
		Subject:  "",//邮件主题
		Text:     "",//邮件正文
		Image:    "",//邮件附件
		Host:     "",//邮箱服务器
		Port:     ,//端口号
		Username: "",//发件人
		Password: "",//授权码
	}
	Send(info)
}

Documentation

Index

Constants

View Source
const (
	LF         = "\u000A"               // \n
	CR         = "\u000D"               // \r
	CRLf       = "\U000D000A"           // \r\n
	DOUBLECRLF = "\U000D000A\U000D000A" // \r\n\r\n
	NULL       = "\u0000"               // null
	NBSP       = "\u00A0"               // No-Break Space
	BR         = "<br>"
)

Variables

View Source
var Gmail = &Server{
	POP3:     "pop.gmail.com",
	POP3Port: 995,
	SMTP:     "smtp.gmail.com",
	SMTPProt: 587,
}
View Source
var NetEase = &Server{
	POP3:     "pop.163.com",
	POP3Port: 110,
	SMTP:     "smtp.163.com",
	SMTPProt: 25,
}
View Source
var QQ = &Server{
	POP3:     "pop.qq.com",
	POP3Port: 995,
	SMTP:     "smtp.qq.cocm",
	SMTPProt: 465,
}

Functions

func Send

func Send(info *Info)

Types

type Info

type Info struct {
	Form     string   `json:"form"`
	To       []string `json:"to"`
	Subject  string   `json:"subject"`
	Text     string   `json:"text"`
	Image    string   `json:"image"`
	Host     string   `json:"host"`
	Port     int      `json:"port"`
	Username string   `json:"username"`
	Password string   `json:"password"`
}

func (*Info) AppendText added in v0.0.14

func (i *Info) AppendText(s string)

func (*Info) SetFrom added in v0.0.13

func (i *Info) SetFrom(s string)

func (*Info) SetHost added in v0.0.13

func (i *Info) SetHost(s string)

func (*Info) SetImage added in v0.0.13

func (i *Info) SetImage(s string)

func (*Info) SetPassword added in v0.0.13

func (i *Info) SetPassword(s string)

func (*Info) SetPort added in v0.0.13

func (i *Info) SetPort(n int)

func (*Info) SetSubject added in v0.0.5

func (i *Info) SetSubject(s string)

func (*Info) SetText added in v0.0.5

func (i *Info) SetText(s string)

func (*Info) SetTo added in v0.0.13

func (i *Info) SetTo(s []string)

func (*Info) SetUsername added in v0.0.13

func (i *Info) SetUsername(s string)

type Server

type Server struct {
	POP3     string
	POP3Port int
	SMTP     string
	SMTPProt int
}

Jump to

Keyboard shortcuts

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