Documentation ¶
Overview ¶
Took me a while to wrap my head around so here is a bit of an explanation for future reference. Think of Entity as an expanded definition of an RFC 5322 message. The basic syntax is: header + blank line + body.
The header may or may not contain MIME related headers, i.e. Content-* A multipart entity is just one with a Content-Type: multipart/*; boundary=* header along with a special body syntax, but otherwise still retains the basic header + blank line + (multipart-body) syntax
Index ¶
- func DetectContentType(data []byte) (ctype string, charset string)
- type Entity
- func NewEntity(headers []header.Header, body string) *Entity
- func NewMultipart(subtype string, headers []header.Header, parts []*Entity) *Entity
- func NewMultipartAlternative(headers []header.Header, parts []*Entity) *Entity
- func NewMultipartMixed(headers []header.Header, parts []*Entity) *Entity
- func NewMultipartRelated(headers []header.Header, parts []*Entity) *Entity
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectContentType ¶
DetectContentType returns content type and charset if applicable It splits the two unlike http.DetectContentType
Types ¶
type Entity ¶
Entity refers to MIME-defined header fields and contents can be either message entity or multipart entity
syntax:
entity-headers := [ content CRLF ] [ encoding CRLF ] [ id CRLF ] [ description CRLF ] *( MIME-extension-field CRLF ) MIME-message-headers := entity-headers fields version CRLF MIME-part-headers := entity-headers [ fields ]
func NewMultipart ¶
NewMultipart returns an entity with content-type set as multipart/subtype
func NewMultipartAlternative ¶
NewMultipartAlternative returns multipart/alternative entity Parts should be in ascending (least to greatest) order of preference preference