utils

package
v0.0.0-...-9ca138e Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2018 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BLErrorVerificationNotFoundUser = errors.New("BLErrorVerificationNotFoundUser")

	BLErrorVerificationInvalidRegID = errors.New("BLErrorVerificationInvalidRegID")

	BLErrorVerificationNotConfirmedRegID = errors.New("BLErrorVerificationNotConfirmedRegID")
)

Functions

func CheckError

func CheckError(err error)

func SendEmail

func SendEmail(from string, login string, password string, recipientMailList []string, subject string, htmlText string)

Types

type Attachment

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

Attachment is a struct representing an email attachment. Based on the mime/multipart.FileHeader struct, Attachment contains the name, MIMEHeader, and content of the attachment in question

type Email

type Email struct {
	Auth        smtp.Auth
	Identity    string `json:"identity"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	Host        string `json:"host"`
	Port        int    `json:"port"`
	From        string `json:"from"`
	To          []string
	Bcc         []string
	Cc          []string
	Subject     string
	Text        string // Plaintext message (optional)
	HTML        string // Html message (optional)
	Headers     textproto.MIMEHeader
	Attachments []*Attachment
	ReadReceipt []string
}

Email is the type used for email messages

func NewEMail

func NewEMail(from string, login string, password string) *Email

NewEMail create new Email struct with config json. config json is followed from Email struct fields.

func (*Email) Attach

func (e *Email) Attach(r io.Reader, filename string, args ...string) (a *Attachment, err error)

Attach is used to attach content from an io.Reader to the email. Parameters include an io.Reader, the desired filename for the attachment, and the Content-Type.

func (*Email) AttachFile

func (e *Email) AttachFile(args ...string) (a *Attachment, err error)

AttachFile Add attach file to the send mail

func (*Email) Bytes

func (e *Email) Bytes() ([]byte, error)

Bytes Make all send information to byte

func (*Email) Send

func (e *Email) Send() error

Send will send out the mail

Jump to

Keyboard shortcuts

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