email

package
v0.0.0-...-94f5cdd Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package email implements the parsing of email and mime mail messages, and may also be used to create and send email messages.

Index

Constants

View Source
const (
	// MaxHeaderLineLength ...
	MaxHeaderLineLength = 78

	// MaxHeaderTotalLength ...
	MaxHeaderTotalLength = 998
)
View Source
const (
	// MaxBodyLineLength ...
	MaxBodyLineLength = 76
)

Variables

View Source
var ErrHeadersMissingField = errors.New("Message missing header field")

ErrHeadersMissingField ...

Functions

func GenContentID

func GenContentID(filename string) (string, error)

GenContentID creates and returns a Content-ID, without surrounding angle brackets.

func GenMessageID

func GenMessageID() (string, error)

GenMessageID creates and returns a Message-ID, without surrounding angle brackets.

Types

type Header map[string][]string

Header represents the key-value MIME-style pairs in a mail message header. Based on textproto.MIMEHeader and mail.Header.

func NewHeader

func NewHeader(from string, subject string, to ...string) Header

NewHeader returns a Header for the most typical use case: a From address, a Subject, and a variable number of To addresses.

func (Header) Add

func (h Header) Add(key, value string)

Add adds the key, value pair to the header. It appends to any existing values associated with key.

func (Header) AddressList

func (h Header) AddressList(key string) ([]*mail.Address, error)

AddressList parses the named header field as a list of addresses.

func (Header) Bcc

func (h Header) Bcc() []