Documentation ¶
Overview ¶
utilities to work on raw message
Index ¶
- Variables
- func FoldHeader(header *[]byte)
- func GetHostFromAddress(address string) string
- func RawGetHeaders(raw *[]byte) []byte
- func RawGetMessageId(raw *[]byte) []byte
- func RawHaveHeader(raw *[]byte, header string) bool
- type Envelope
- type Message
- func (m *Message) AddHeader(key, value string)
- func (m *Message) DelHeader(key string)
- func (m *Message) GetHeader(key string) string
- func (m *Message) GetHeaders(key string) []string
- func (m *Message) GetRaw() (rawMessage []byte, err error)
- func (m *Message) HaveHeader(key string) bool
- func (m *Message) SetHeader(key, value string)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNonAsciiCharDetected when an email body does not contain only 7 bits ascii char ErrNonAsciiCharDetected = errors.New("email must contains only 7-bit ASCII characters") )
Functions ¶
func FoldHeader ¶
func FoldHeader(header *[]byte)
FoldHeader retun header value according to RFC 2822 https://tools.ietf.org/html/rfc2822#section-2.1.1 There are two limits that this standard places on the number of characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF. TODO: refactor Foldheader
func GetHostFromAddress ¶
getHostFromAddress returns host part from an email address Warning this check assume to get a valid email address
func RawGetMessageId ¶
RawGetMessageId return Message-ID or empty string if to found
func RawHaveHeader ¶
RawHaveHeader check igf header header is present in raw mail
Types ¶
type Message ¶
message represents an email message
func (*Message) GetHeader ¶
getHeader get one header, or the first occurence if there is multipke headers with this key
func (*Message) GetHeaders ¶
getHeaders returns all the headers corresponding to the key key
func (*Message) GetRaw ¶
getRaw returns raw message some cleanup are made wrap headers line to 999 char max
func (*Message) HaveHeader ¶
heaveHeader check the existence of header header