Documentation
¶
Index ¶
- Variables
- func DecodeCharset(original []byte, mediaType string, contentTypeParams map[string]string) ([]byte, error)
- func DecodeContentEncoding(r io.Reader, contentEncoding string) (d io.Reader)
- func DecodeHeader(raw string) (decoded string, err error)
- func EncodeHeader(s string) string
- func GetAllChildParts(part io.Reader, h textproto.MIMEHeader) (parts []io.Reader, headers []textproto.MIMEHeader, err error)
- func GetMultipartParts(r io.Reader, params map[string]string) (parts []io.Reader, headers []textproto.MIMEHeader, err error)
- func GetRawMimePart(rawdata io.Reader, boundary string) (io.Reader, io.Reader)
- func IsLeaf(h textproto.MIMEHeader) bool
- func NewUtf7Decoder() *encoding.Decoder
- func VisitAll(part io.Reader, h textproto.MIMEHeader, accepter VisitAcceptor) (err error)
- type AttachmentsCollector
- type BodyCollector
- type MIMEPrinter
- type MimeVisitor
- type PlainTextCollector
- type VisitAcceptor
Constants ¶
This section is empty.
Variables ¶
var ErrBadUTF7 = errors.New("utf7: bad utf-7 encoding")
ErrBadUTF7 is returned to indicate the invalid modified UTF-7 encoding.
Functions ¶
func DecodeCharset ¶
func DecodeCharset(original []byte, mediaType string, contentTypeParams map[string]string) ([]byte, error)
DecodeCharset decodes the orginal using content type parameters. When charset missing it checks the content is utf8-valid.
func DecodeContentEncoding ¶
DecodeContentEncoding wraps the reader with decoder based on content encoding
func DecodeHeader ¶
DecodeHeader if needed. Returns error if raw contains non-utf8 characters
func GetAllChildParts ¶
func GetAllChildParts(part io.Reader, h textproto.MIMEHeader) (parts []io.Reader, headers []textproto.MIMEHeader, err error)
func GetMultipartParts ¶
func GetRawMimePart ¶
func IsLeaf ¶
func IsLeaf(h textproto.MIMEHeader) bool
func NewUtf7Decoder ¶
NewUtf7Decoder return decoder for utf7
func VisitAll ¶
func VisitAll(part io.Reader, h textproto.MIMEHeader, accepter VisitAcceptor) (err error)
Types ¶
type AttachmentsCollector ¶
type AttachmentsCollector struct {
// contains filtered or unexported fields
}
func NewAttachmentsCollector ¶
func NewAttachmentsCollector(targetAccepter VisitAcceptor) *AttachmentsCollector
func (*AttachmentsCollector) Accept ¶
func (ac *AttachmentsCollector) Accept(partReader io.Reader, header textproto.MIMEHeader, hasPlainSibling bool, isFirst, isLast bool) (err error)
func (AttachmentsCollector) GetAttHeaders ¶
func (ac AttachmentsCollector) GetAttHeaders() []string
func (AttachmentsCollector) GetAttachments ¶
func (ac AttachmentsCollector) GetAttachments() []string
type BodyCollector ¶
type BodyCollector struct {
// contains filtered or unexported fields
}
func NewBodyCollector ¶
func NewBodyCollector(targetAccepter VisitAcceptor) *BodyCollector
func (*BodyCollector) Accept ¶
func (bc *BodyCollector) Accept(partReader io.Reader, header textproto.MIMEHeader, hasPlainSibling bool, isFirst, isLast bool) (err error)
func (*BodyCollector) GetBody ¶
func (bc *BodyCollector) GetBody() (string, string)
func (*BodyCollector) GetHeaders ¶
func (bc *BodyCollector) GetHeaders() string
type MIMEPrinter ¶
type MIMEPrinter struct {
// contains filtered or unexported fields
}
func NewMIMEPrinter ¶
func NewMIMEPrinter() (pd *MIMEPrinter)
func (*MIMEPrinter) Accept ¶
func (pd *MIMEPrinter) Accept(partReader io.Reader, header textproto.MIMEHeader, hasPlainSibling bool, isFirst, isLast bool) (err error)
func (*MIMEPrinter) String ¶
func (pd *MIMEPrinter) String() string
type MimeVisitor ¶
type MimeVisitor struct {
// contains filtered or unexported fields
}
MIMEVisitor is main object to parse (visit) and process (accept) all parts of MIME message
func NewMimeVisitor ¶
func NewMimeVisitor(targetAccepter VisitAcceptor) *MimeVisitor
NewMIMEVisitor initialiazed with acceptor
func (*MimeVisitor) Accept ¶
func (mv *MimeVisitor) Accept(part io.Reader, h textproto.MIMEHeader, hasPlainSibling bool, isFirst, isLast bool) (err error)
Accept reads part recursively if needed hasPlainSibling is there when acceptor want to check alternatives
type PlainTextCollector ¶
type PlainTextCollector struct {
// contains filtered or unexported fields
}
func NewPlainTextCollector ¶
func NewPlainTextCollector(targetAccepter VisitAcceptor) *PlainTextCollector
func (*PlainTextCollector) Accept ¶
func (ptc *PlainTextCollector) Accept(partReader io.Reader, header textproto.MIMEHeader, hasPlainSibling bool, isFirst, isLast bool) (err error)
func (PlainTextCollector) GetPlainText ¶
func (ptc PlainTextCollector) GetPlainText() string
type VisitAcceptor ¶
type VisitAcceptor interface {
Accept(partReader io.Reader, header textproto.MIMEHeader, hasPlainSibling bool, isFirst, isLast bool) (err error)
}
VisitAcceptor decidest what to do with part which is processed It is used by MIMEVisitor