dto

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT-0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	Headers ContentHeaders
	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

type ContentHeaders

type ContentHeaders struct {
	// contains filtered or unexported fields
}

func (*ContentHeaders) All

func (headers *ContentHeaders) All() map[string][]string

func (*ContentHeaders) DateUTC

func (headers *ContentHeaders) DateUTC() (time.Time, error)

func (*ContentHeaders) From

func (headers *ContentHeaders) From() (EmailInfo, error)

func (*ContentHeaders) Get

func (headers *ContentHeaders) Get(key string) ([]string, error)

func (*ContentHeaders) GetOne

func (headers *ContentHeaders) GetOne(key string) (string, error)

func (*ContentHeaders) Has

func (headers *ContentHeaders) Has(key string) bool

func (*ContentHeaders) Set

func (headers *ContentHeaders) Set(key string, val []string) *ContentHeaders

func (*ContentHeaders) To

func (headers *ContentHeaders) To() []EmailInfo

type EmailInfo

type EmailInfo struct {
	Name  string
	Email string
}

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
	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() MessageID

NewMessageID generates a new message ID

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

func FromBytes(b []byte) *SMTPMessage

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

func (*SMTPMessage) Bytes

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

Bytes returns an io.Reader containing the raw message data

func (*SMTPMessage) Parse

func (message *SMTPMessage) Parse() *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