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
- Variables
- func GenContentID(filename string) (string, error)
- func GenMessageID() (string, error)
- type Header
- func (h Header) Add(key, value string)
- func (h Header) AddressList(key string) ([]*mail.Address, error)
- func (h Header) Bcc() []string
- func (h Header) Bytes() ([]byte, error)
- func (h Header) Cc() []string
- func (h Header) ContentDisposition() (string, map[string]string, error)
- func (h Header) ContentType() (string, map[string]string, error)
- func (h Header) Date() (time.Time, error)
- func (h Header) Del(key string)
- func (h Header) From() string
- func (h Header) Get(key string) string
- func (h Header) IsSet(key string) bool
- func (h Header) Save() error
- func (h Header) Set(key, value string)
- func (h Header) SetBcc(emails ...string)
- func (h Header) SetCc(emails ...string)
- func (h Header) SetFrom(email string)
- func (h Header) SetSubject(subject string)
- func (h Header) SetTo(emails ...string)
- func (h Header) Subject() string
- func (h Header) To() []string
- func (h Header) WriteTo(w io.Writer) (int64, error)
- type Message
- func NewMessage(headers Header, textPlain string, html string, attachments ...*Message) *Message
- func NewMessageWithInlines(headers Header, textPlain string, html string, inlines []*Message, ...) *Message
- func NewPartAttachment(r io.Reader, filename string) (*Message, error)
- func NewPartAttachmentFromBytes(raw []byte, filename string) *Message
- func NewPartHTML(html string) *Message
- func NewPartInline(r io.Reader, filename string, contentID string) (*Message, error)
- func NewPartInlineFromBytes(raw []byte, filename string, contentID string) *Message
- func NewPartMultipart(multipartSubType string, parts ...*Message) *Message
- func NewPartText(textPlain string) *Message
- func ParseMessage(r io.Reader) (*Message, error)
- func (m *Message) Bytes() ([]byte, error)
- func (m *Message) DeliveryStatusMessageDNS() (Header, error)
- func (m *Message) DeliveryStatusRecipientDNS() ([]Header, error)
- func (m *Message) HasBody() bool
- func (m *Message) HasDeliveryStatusMessage() bool
- func (m *Message) HasFeedbackReportMessage() bool
- func (m *Message) HasParts() bool
- func (m *Message) HasSubMessage() bool
- func (m *Message) MessagesAll() []*Message
- func (m *Message) MessagesContentTypePrefix(contentTypePrefix string) []*Message
- func (m *Message) MessagesFilter(filter func(*Message) bool) []*Message
- func (m *Message) PartsContentTypePrefix(contentTypePrefix string) []*Message
- func (m *Message) PartsFilter(filter func(*Message) bool) []*Message
- func (m *Message) Payload() interface{}
- func (m *Message) Save() error
- func (m *Message) Send(smtpAddressPort string, auth smtp.Auth) error
- func (m *Message) WriteTo(w io.Writer) (int64, error)
Constants ¶
const ( // MaxHeaderLineLength ... MaxHeaderLineLength = 78 // MaxHeaderTotalLength ... MaxHeaderTotalLength = 998 )
const (
// MaxBodyLineLength ...
MaxBodyLineLength = 76
)
Variables ¶
var ErrHeadersMissingField = errors.New("Message missing header field")
ErrHeadersMissingField ...
Functions ¶
func GenContentID ¶
GenContentID creates and returns a Content-ID, without surrounding angle brackets.
func GenMessageID ¶
GenMessageID creates and returns a Message-ID, without surrounding angle brackets.
Types ¶
type Header ¶
Header represents the key-value MIME-style pairs in a mail message header. Based on textproto.MIMEHeader and mail.Header.
func NewHeader ¶
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 ¶
Add adds the key, value pair to the header. It appends to any existing values associated with key.
func (Header) AddressList ¶
AddressList parses the named header field as a list of addresses.