Documentation
¶
Index ¶
- Variables
- func CollapseRFC2231Value(p Param) string
- func FormatDateLocal() string
- func Quote(s string) string
- func Unquote(s string) string
- type Address
- type DecodedPart
- type HeaderValue
- type Message
- func (m *Message) Get(name string) (HeaderValue, bool)
- func (m *Message) GetAll(name string) []HeaderValue
- func (m *Message) GetBoundary() (string, bool)
- func (m *Message) GetContentCharset() (string, bool)
- func (m *Message) GetContentMaintype() string
- func (m *Message) GetContentSubtype() string
- func (m *Message) GetContentType() string
- func (m *Message) GetFilename() (string, bool)
- func (m *Message) GetPayloadDecoded() []byte
- func (m *Message) IsMultipart() bool
- func (m *Message) Items() [][2]string
- func (m *Message) Walk() []*Message
- type Param
- type Part
Constants ¶
This section is empty.
Variables ¶
var ErrEmbeddedHeader = errors.New("header value appears to contain an embedded header")
ErrEmbeddedHeader is the HeaderParseError of a value that would inject a header line
var ErrHeaderParse = errors.New("Base64 decoding error")
HeaderParseError is the error decode_header raises for an encoded word that does not decode
var ErrUnorderable = errors.New("'<' not supported between instances of 'NoneType' and 'int'")
ErrUnorderable is the TypeError of sorting continuations that mix numbered and unnumbered segments
Functions ¶
func CollapseRFC2231Value ¶
Text of a parameter, an RFC2231 triple decoded from its charset with replacement, us-ascii when unnamed
func FormatDateLocal ¶
func FormatDateLocal() string
RFC 2822 date of the current local time with its numeric zone
Types ¶
type Address ¶
Address is one parsed mailbox, its display name and addr-spec
func GetAddresses ¶
Real name and address pairs of the field values under the strict parser, one empty pair when the count is off
type DecodedPart ¶
DecodedPart is one run of a decoded header, text for the single undecoded form and bytes with a charset otherwise
func DecodeHeader ¶
func DecodeHeader(header HeaderValue) ([]DecodedPart, error)
Decodes a header value without converting charsets, one text part when it holds no encoded word
type HeaderValue ¶
type HeaderValue string
HeaderValue is a raw header value, bytes above ASCII kept as they arrived
func (HeaderValue) Has8Bit ¶
func (h HeaderValue) Has8Bit() bool
Whether the value carries bytes above ASCII, read by compat32 as an unknown-8bit Header
func (HeaderValue) Str ¶
func (h HeaderValue) Str() string
str of the value, each byte above ASCII shown as the replacement character
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message is a parsed MIME message under the compat32 policy, header values and payload kept as raw bytes
func ParseBytes ¶
Parses a whole message from bytes, headers only when asked with the rest of the text as its payload
func (*Message) Get ¶
func (m *Message) Get(name string) (HeaderValue, bool)
First value of a header matched without case, false when the message has none
func (*Message) GetAll ¶
func (m *Message) GetAll(name string) []HeaderValue
Every value of a header matched without case in message order
func (*Message) GetBoundary ¶
Boundary parameter of the Content-Type header with trailing white space removed
func (*Message) GetContentCharset ¶
Lowercased charset parameter of the Content-Type header, false when missing or not ASCII
func (*Message) GetContentMaintype ¶
func (*Message) GetContentSubtype ¶
func (*Message) GetContentType ¶
Lowercased maintype/subtype of the Content-Type header, the default type without one and text/plain for a malformed one
func (*Message) GetFilename ¶
File name of the payload from the Content-Disposition filename, else the Content-Type name
func (*Message) GetPayloadDecoded ¶
Payload decoded by its Content-Transfer-Encoding, nil for a multipart message
func (*Message) IsMultipart ¶
Whether the payload is a list of sub messages
type Param ¶
Param is one header parameter, RFC2231 set when the value is the charset, language and text triple
type Part ¶
type Part struct {
// contains filtered or unexported fields
}
Part is a MIME entity under construction, a leaf with an encoded text payload or a multipart container
func NewBase64 ¶
Binary part of the given type carried as base64, its last line unterminated unless the data ends in a line feed
func NewMultipart ¶
func NewMultipart() *Part
Empty multipart/mixed container with its MIME version header