eml

package module
v0.0.2 Latest Latest
Warning

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

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

README

#EML(RFC5322) PARSER

This aims to be a more complete implementation of go's net/mail package.

This is parser of message in rfc5322(.eml)

Split message on all headers(subject,from,to,cc,date,et.c.), body text, body html, and attachments(decodes it)

add decoder for subject and attachments file name

Documentation

Overview

Package mail implements a parser for electronic mail messages as specified in RFC5322.

We allow both CRLF and LF to be used in the input, possibly mixed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDate

func ParseDate(s string) time.Time

Types

type Address

type Address interface {
	String() string
	Name() string
	Email() string
}

func ParseAddress

func ParseAddress(bs []byte) (Address, error)

type Attachment

type Attachment struct {
	Filename string
	Data     []byte
}

type DecodedAddress

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

func CreateDecodedAddress

func CreateDecodedAddress(addr Address) DecodedAddress

func (DecodedAddress) Email

func (da DecodedAddress) Email() string

func (DecodedAddress) Name

func (da DecodedAddress) Name() string

func (DecodedAddress) String

func (da DecodedAddress) String() string

type GroupAddr

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

func (GroupAddr) Email

func (ga GroupAddr) Email() string

func (GroupAddr) Name

func (ga GroupAddr) Name() string

func (GroupAddr) String

func (ga GroupAddr) String() string
type Header struct {
	Key, Value string
}

type HeaderInfo

type HeaderInfo struct {
	FullHeaders HeaderList // all headers

}

type HeaderList

type HeaderList map[string][]string

func (HeaderList) Add

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

func (HeaderList) Bcc

func (h HeaderList) Bcc() []Address

func (HeaderList) Cc

func (h HeaderList) Cc() []Address

func (HeaderList) Comments

func (h HeaderList) Comments() []string

func (HeaderList) ContentType

func (h HeaderList) ContentType() string

func (HeaderList) Date

func (h HeaderList) Date() time.Time

func (HeaderList) FirstByKey

func (h HeaderList) FirstByKey(key string) (string, bool)

func (HeaderList) From

func (h HeaderList) From() []Address

func (HeaderList) InReply

func (h HeaderList) InReply() []string

func (HeaderList) Keywords

func (h HeaderList) Keywords() []string

func (HeaderList) MediaType

func (h HeaderList) MediaType() MediaType

func (HeaderList) MessageId

func (h HeaderList) MessageId() string

func (HeaderList) References

func (h HeaderList) References() []string

func (HeaderList) ReplyTo

func (h HeaderList) ReplyTo() []Address

func (HeaderList) Sender

func (h HeaderList) Sender() Address

func (HeaderList) Set

func (h HeaderList) Set(key string, value []string)

func (HeaderList) Subject

func (h HeaderList) Subject() string

func (HeaderList) To

func (h HeaderList) To() []Address

type MailboxAddr

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

func (MailboxAddr) Email

func (ma MailboxAddr) Email() string

func (MailboxAddr) Name

func (ma MailboxAddr) Name() string

func (MailboxAddr) String

func (ma MailboxAddr) String() string

type MediaType

type MediaType struct {
	Type   string
	Params map[string]string
}

type Message

type Message struct {
	HeaderInfo
	Body        []byte
	Text        string
	Html        string
	Attachments []Attachment
	Parts       []Part
}

func Parse

func Parse(s []byte) (m Message, e error)

func Process

func Process(r RawMessage) (m Message, e error)

type Part

type Part struct {
	Type    string
	Charset string
	Data    []byte
	Headers map[string][]string
}

type RawHeader

type RawHeader struct {
	Key, Value []byte
}

type RawMessage

type RawMessage struct {
	RawHeaders []RawHeader
	Body       []byte
}

func ParseRaw

func ParseRaw(s []byte) (m RawMessage, e error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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