data

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2017 License: MIT Imports: 8 Imported by: 195

README

MailHog data library GoDoc Build Status

github.com/mailhog/data implements a data library

Licence

Copyright ©‎ 2014-2015, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogHandler func(message string, args ...interface{})

LogHandler is called for each log message. If nil, log messages will be output using log.Printf instead.

Functions

This section is empty.

Types

type Content

type Content struct {
	Headers map[string][]string
	Body    string
	Size    int
	MIME    *MIMEBody
}

Content represents the body content of an SMTP message

func ContentFromString

func ContentFromString(data string) *Content

ContentFromString parses SMTP content into separate headers and body

func (*Content) IsMIME

func (content *Content) IsMIME() bool

IsMIME detects a valid MIME header

func (*Content) ParseMIMEBody

func (content *Content) ParseMIMEBody() *MIMEBody

ParseMIMEBody parses SMTP message content into multiple MIME parts

type MIMEBody

type MIMEBody struct {
	Parts []*Content
}

MIMEBody represents a collection of MIME parts

type Message

type Message struct {
	ID      MessageID
	From    *Path
	To      []*Path
	Content *Content
	Created time.Time
	MIME    *MIMEBody // FIXME refactor to use Content.MIME
	Raw     *SMTPMessage
}

Message represents a parsed SMTP message

func (*Message) Bytes added in v0.2.0

func (m *Message) Bytes() io.Reader

Bytes returns an io.Reader containing the raw message data

type MessageID

type MessageID string

MessageID represents the ID of an SMTP message including the hostname part

func NewMessageID

func NewMessageID(hostname string) (MessageID, error)

NewMessageID generates a new message ID

type Messages

type Messages []Message

Messages represents an array of Messages - TODO is this even required?

type Path

type Path struct {
	Relays  []string
	Mailbox string
	Domain  string
	Params  string
}

Path represents an SMTP forward-path or return-path

func PathFromString

func PathFromString(path string) *Path

PathFromString parses a forward-path or reverse-path into its parts

type SMTPMessage

type SMTPMessage struct {
	From string
	To   []string
	Data string
	Helo string
}

SMTPMessage represents a raw SMTP message

func FromBytes added in v0.2.0

func FromBytes(b []byte) *SMTPMessage

FromBytes returns a SMTPMessage from raw message bytes (as output by SMTPMessage.Bytes())

func (*SMTPMessage) Bytes added in v0.2.0

func (m *SMTPMessage) Bytes() io.Reader

Bytes returns an io.Reader containing the raw message data

func (*SMTPMessage) Parse

func (m *SMTPMessage) Parse(hostname string) *Message

Parse converts a raw SMTP message to a parsed MIME message

Jump to

Keyboard shortcuts

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