smtp

package
v0.0.0-...-5c0bb04 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mail

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

Mail smtp adapter

func NewSMTP

func NewSMTP(opt ...Option) *Mail

NewSMTP return a opened *Mail

func (*Mail) Send

func (m *Mail) Send(to []string, msg string) error

Send use smtp send email to := []string{"recipient@example.net"} msg := []byte("To: recipient@example.net\r\n" +

"Subject: discount Gophers!\r\n" +
"\r\n" +
"This is the email body.\r\n")

err := smtp.SendMail("mail.example.com:25", auth, "sender@example.org", to, msg)

if err != nil {
   log.Fatal(err)
}

type Option

type Option func(*Mail)

Option option mail field

func WithFrom

func WithFrom(from string) Option

WithFrom set from

func WithHost

func WithHost(host string) Option

WithHost set host

func WithPassword

func WithPassword(password string) Option

WithPassword set password

func WithUsername

func WithUsername(username string) Option

WithUsername set username

Jump to

Keyboard shortcuts

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