mail

package
v0.0.0-...-06c7680 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdleTimeout     = time.Second * 10
	PoolWaitTimeout = time.Second * 5
	MaxConns        = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename string
	Header   textproto.MIMEHeader
	Content  []byte
}

type ContentType

type ContentType uint8
const (
	PLAIN ContentType = iota
	HTML
)

type Dummy

type Dummy struct{}

func (*Dummy) Close

func (d *Dummy) Close() error

func (*Dummy) Send

func (d *Dummy) Send(mail Mail) error

type Mail

type Mail struct {
	From        string
	To          []string
	Cc          []string
	Bcc         []string
	ContentType ContentType
	Headers     textproto.MIMEHeader
	Subject     string
	Body        []byte
	Attachments []Attachment
}

func MailFromTemplate

func MailFromTemplate(fileName string, data interface{}) (*Mail, error)

func (*Mail) Attach

func (m *Mail) Attach(r io.Reader, filename string, ct string) error

func (*Mail) AttachFile

func (m *Mail) AttachFile(path string) error

type Mailer

type Mailer interface {
	Send(mail Mail) error
	Close() error
}

func NewDummy

func NewDummy() Mailer

func NewMailer

func NewMailer(host string, port int, username, password, authProto string, enableTLS bool) (Mailer, error)

func NewMailerFromConfig

func NewMailerFromConfig(conf *config.SMTP) (Mailer, error)

type SMTPClient

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

func (*SMTPClient) Close

func (c *SMTPClient) Close() error

func (*SMTPClient) Send

func (c *SMTPClient) Send(mail Mail) error

Jump to

Keyboard shortcuts

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