data

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2015 License: MIT Imports: 6 Imported by: 0

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

This section is empty.

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

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 (*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