smtp

package
v0.0.0-...-2083224 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(addr string) (*smtp.Client, error)

Dial return a smtp client

func SendMail

func SendMail(host, user, password, to, subject, body, mailtype string) error

SendMail send email

func SendMailUsingTLS

func SendMailUsingTLS(addr string, auth smtp.Auth, from string,
	to []string, msg []byte) (err error)

SendMailUsingTLS 参考net/smtp的func SendMail() 使用net.Dial连接tls(ssl)端口时,smtp.NewClient()会卡住且不提示err len(to)>1时,to[1]开始提示是密送

Types

type Client

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

Client simple email client support ssl

func New

func New(user, password, nickName, host string, port int, isSsl bool) *Client

New new email client

func (*Client) SendEmail

func (ec *Client) SendEmail(toUser []string, subject string, content string) error

SendEmail send email by string content

func (*Client) SendEmailByte

func (ec *Client) SendEmailByte(toUser []string, subject string, body []byte) error

SendEmailByte send email by byte body

type Email

type Email struct {
	Host     string
	User     string
	Password string
	To       string
	Subject  string
	Body     string
	MailType string
}

Email email struct

func (*Email) Send

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

Send send email

func (*Email) Server

func (email *Email) Server(host, user, password string) bool

Server set email server

Jump to

Keyboard shortcuts

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