smtp

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptySender     = errors.New("Empty Sender")
	ErrEmptyRecipients = errors.New("Empty Recipients")
	ErrEmptySubject    = errors.New("Empty Subject")
	ErrEmptyContent    = errors.New("Empty Content")
)
View Source
var CRLF = []byte("\r\n")

Functions

func Address

func Address(a ...string) *mail.Address

Types

type AddressList

type AddressList []*mail.Address

func (AddressList) List

func (list AddressList) List() []string

func (AddressList) String

func (list AddressList) String() string

type Attachment

type Attachment struct {
	Name        string
	ContentType string
	io.Reader
}

type Mail

type Mail struct {
	Subject     string
	PlainText   []byte
	Html        []byte
	Attachments []*Attachment
}

func (*Mail) Encode

func (mail *Mail) Encode(from *mail.Address, to AddressList) []byte

TODO: add cc and bcc support

type OTOSendError

type OTOSendError struct {
	Errors []*SendError
}

func (*OTOSendError) Error

func (err *OTOSendError) Error() string

type SMTP

type SMTP struct {
	DefaultFrom *netmail.Address
	// contains filtered or unexported fields
}

func New

func New(host string, port uint16, username string, password string, defaultForm string) *SMTP

func (*SMTP) Auth

func (s *SMTP) Auth() (err error)

func (*SMTP) SendMail

func (s *SMTP) SendMail(mail *Mail, from interface{}, to interface{}, oneToOne bool) (err error)

type SendError

type SendError struct {
	Message string
	From    *mail.Address
	To      AddressList
}

func (*SendError) Error

func (err *SendError) Error() string

Jump to

Keyboard shortcuts

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