mail

package
v0.0.0-...-7690095 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAttachmentLimit = 25 * 1024 * 1024
View Source
const MaxInt = int64(^uint64(0) >> 1)

Variables

View Source
var ErrAttachmentExceedLimit = errors.New("attachment is bigger than limit")
View Source
var ErrEmailInvalid = errors.New("invalid email address")
View Source
var ErrFileInvalid = errors.New("invalid file")
View Source
var ErrFileIsDir = errors.New("cannot attach directory")

Functions

func EncodeBase64WithNewLine

func EncodeBase64WithNewLine(content []byte) (b []byte, size int64)

func EncodeQuotedPrintable

func EncodeQuotedPrintable(value []byte) []byte

func EncodeQuotedPrintableString

func EncodeQuotedPrintableString(value string) string

func MergeMessageWithSignature

func MergeMessageWithSignature(msg, mimetype, sign string) []byte

Types

type Addresses

type Addresses []mail.Address

func (Addresses) String

func (ad Addresses) String() string

type Attachment

type Attachment struct {
	Name string
	Data []byte
}

type Mail

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

TODO: add inline attachment (mainly for inline images) support

func NewMail

func NewMail() *Mail

func (*Mail) AddBcc

func (m *Mail) AddBcc(email, name string) error

func (*Mail) AddCc

func (m *Mail) AddCc(email, name string) error

func (*Mail) AddHeader

func (m *Mail) AddHeader(key, value string)

func (*Mail) AddTo

func (m *Mail) AddTo(email, name string) error

func (*Mail) AppendHTMLMessage

func (m *Mail) AppendHTMLMessage(msg string)

func (*Mail) AppendMessage

func (m *Mail) AppendMessage(mimetype, msg string)

func (*Mail) AppendTextMessage

func (m *Mail) AppendTextMessage(msg string)

func (*Mail) Attach

func (m *Mail) Attach(name string, b []byte) error

func (*Mail) AttachFD

func (m *Mail) AttachFD(fd *os.File) error

func (*Mail) AttachFile

func (m *Mail) AttachFile(fpath string) (err error)

func (*Mail) AttachmentLimit

func (m *Mail) AttachmentLimit() int64

func (*Mail) Attachments

func (m *Mail) Attachments() []Attachment

func (*Mail) Bcc

func (m *Mail) Bcc() Addresses

func (*Mail) BounceTo

func (m *Mail) BounceTo() mail.Address

func (*Mail) Bytes

func (m *Mail) Bytes() []byte

func (*Mail) Cc

func (m *Mail) Cc() Addresses

func (*Mail) Clone

func (m *Mail) Clone() *Mail

func (*Mail) DelHeader

func (m *Mail) DelHeader(key string)

func (*Mail) From

func (m *Mail) From() mail.Address

func (*Mail) GetHeader

func (m *Mail) GetHeader(key string) string

func (*Mail) Message

func (m *Mail) Message() map[string]string

func (*Mail) ReplyTo

func (m *Mail) ReplyTo() mail.Address

func (*Mail) SetAttachmentLimit

func (m *Mail) SetAttachmentLimit(l int64)

func (*Mail) SetBcc

func (m *Mail) SetBcc(email, name string) error

func (*Mail) SetBounceTo

func (m *Mail) SetBounceTo(email string) error

func (*Mail) SetCc

func (m *Mail) SetCc(email, name string) error

func (*Mail) SetFrom

func (m *Mail) SetFrom(email, name string) error

func (*Mail) SetHTMLMessage

func (m *Mail) SetHTMLMessage(msg string)

func (*Mail) SetHeader

func (m *Mail) SetHeader(key, value string)

func (*Mail) SetMessage

func (m *Mail) SetMessage(mimetype, msg string)

func (*Mail) SetReplyTo

func (m *Mail) SetReplyTo(email, name string) error

func (*Mail) SetSubject

func (m *Mail) SetSubject(subj string)

func (*Mail) SetTextMessage

func (m *Mail) SetTextMessage(msg string)

func (*Mail) SetTo

func (m *Mail) SetTo(email string, name string) error

func (*Mail) String

func (m *Mail) String() string

func (*Mail) Subject

func (m *Mail) Subject() string

func (*Mail) To

func (m *Mail) To() Addresses

type Mailer

type Mailer interface {
	DefaultMail() *Mail
	Server() chan<- *Mail
	SetSignature(string)
	Signature() string
	Send(*Mail) error
	SendAsync(*Mail) <-chan error
}

type MessageEncoder

type MessageEncoder struct {
	*quotedprintable.Writer
	// contains filtered or unexported fields
}

func NewMessageEncoder

func NewMessageEncoder() *MessageEncoder

func (*MessageEncoder) Bytes

func (me *MessageEncoder) Bytes() []byte

func (*MessageEncoder) String

func (me *MessageEncoder) String() string

type SMTPMailer

type SMTPMailer struct {
	*Mail // contains the default settings
	// contains filtered or unexported fields
}

func NewSMTPMailer

func NewSMTPMailer(host string, port int, auth smtp.Auth) *SMTPMailer

func (*SMTPMailer) Auth

func (ml *SMTPMailer) Auth() smtp.Auth

func (*SMTPMailer) DefaultMail

func (ml *SMTPMailer) DefaultMail() *Mail

func (*SMTPMailer) Host

func (ml *SMTPMailer) Host() string

func (*SMTPMailer) Port

func (ml *SMTPMailer) Port() int

func (*SMTPMailer) Send

func (ml *SMTPMailer) Send(m *Mail) error

func (*SMTPMailer) SendAsync

func (ml *SMTPMailer) SendAsync(m *Mail) <-chan error

func (*SMTPMailer) Server

func (ml *SMTPMailer) Server() chan<- *Mail

func (*SMTPMailer) SetAuth

func (ml *SMTPMailer) SetAuth(auth smtp.Auth)

func (*SMTPMailer) SetHost

func (ml *SMTPMailer) SetHost(host string)

func (*SMTPMailer) SetPort

func (ml *SMTPMailer) SetPort(port int)

func (*SMTPMailer) SetSignature

func (ml *SMTPMailer) SetSignature(sign string)

func (*SMTPMailer) Signature

func (ml *SMTPMailer) Signature() string

Jump to

Keyboard shortcuts

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