smtp

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package smtp

Package smtp

Package smtp

Package smtp

Package smtp

Index

Constants

View Source
const (
	Text = "text/plain"
	Html = "text/html"
)
View Source
const (
	ErrCheck      = "check smtp config failed"
	ErrNoTo       = "no receiver found"
	ErrNoHtml     = "no html file specified"
	ErrContextNil = "context is nil"
)

Variables

This section is empty.

Functions

func ModuleName

func ModuleName() string

ModuleName 模块名称

Types

type SmtpClient

type SmtpClient struct {
	Sender     string   // 发件邮箱
	NickSender string   // 发件邮箱的别名 为空时与Sender一致
	PassWord   string   // 发件密码
	SmtpHost   string   // smtp提供商
	SmtpPort   int      // smtp端口
	To         []string // 主送
	Cc         []string // 抄送
	Bcc        []string // 暗送
}

func (*SmtpClient) Send

func (s *SmtpClient) Send(subject, message string, attach []string) error

Send 纯文本 subject 主题 message 正文 attach 附件

func (*SmtpClient) SendContext

func (s *SmtpClient) SendContext(context context.Context, subject, message string, attach []string) error

SendContext 带上下文的发送

func (*SmtpClient) SendHtml

func (s *SmtpClient) SendHtml(subject, data string, isFile bool, attach []string) error

SendHtml html data 文件或者html文本 isFile 为true时data以html文件的方式解析

func (*SmtpClient) SendHtmlContext

func (s *SmtpClient) SendHtmlContext(context context.Context, subject, data string, isFile bool, attach []string) error

SendHtmlContext 带上下文的发送

func (*SmtpClient) Try

func (s *SmtpClient) Try() error

Try 尝试连接

Jump to

Keyboard shortcuts

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