Documentation
¶
Index ¶
- Variables
- func AttachPublicKey(p *parser.Parser, key, keyName string)
- func BuildEncrypted(m *pmapi.Message, readers []io.Reader, kr *crypto.KeyRing) ([]byte, error)
- func BuildMIMEBody(p *parser.Parser) (mimeBody string, err error)
- func GetAttachmentHeader(att *pmapi.Attachment, buildForIMAP bool) textproto.MIMEHeader
- func GetBodyHeader(m *pmapi.Message) textproto.MIMEHeader
- func GetBoundary(m *pmapi.Message) string
- func GetEnvelope(msg *pmapi.Message, header textproto.MIMEHeader) *imap.Envelope
- func GetFlags(m *pmapi.Message) (flags []string)
- func GetHeader(msg *pmapi.Message) textproto.MIMEHeader
- func Parse(r io.Reader) (m *pmapi.Message, mimeBody, plainBody string, attReaders []io.Reader, ...)
- func ParseFlags(m *pmapi.Message, flags []string)
- func ParserWithParser(p *parser.Parser) (m *pmapi.Message, plainBody string, attReaders []io.Reader, err error)
- func SeparateInlineAttachments(m *pmapi.Message) (atts, inlines []*pmapi.Attachment)
- func SetBodyContentFields(h *textproto.MIMEHeader, m *pmapi.Message)
- func WriteHeader(w io.Writer, h textproto.MIMEHeader) (err error)
- type BodyStructure
- func (bs *BodyStructure) GetMailHeader() (header textproto.MIMEHeader, err error)
- func (bs *BodyStructure) GetMailHeaderBytes(wholeMail io.ReadSeeker) (header []byte, err error)
- func (bs *BodyStructure) GetSection(wholeMail io.ReadSeeker, sectionPath []int) (section []byte, err error)
- func (bs *BodyStructure) GetSectionContent(wholeMail io.ReadSeeker, sectionPath []int) (section []byte, err error)
- func (bs *BodyStructure) GetSectionHeader(sectionPath []int) (header textproto.MIMEHeader, err error)
- func (bs *BodyStructure) IMAPBodyStructure(currentPart []int) (imapBS *imap.BodyStructure, err error)
- func (bs *BodyStructure) Parse(r io.Reader) error
- func (bs *BodyStructure) Serialize() ([]byte, error)
- type BuildJob
- type Builder
- type Fetcher
- type JobOptions
- type SectionInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrDecryptionFailed = errors.New("message could not be decrypted") ErrNoSuchKeyRing = errors.New("the keyring to decrypt this message could not be found") )
var ( AppleMailJunkFlag = imap.CanonicalFlag("$Junk") ThunderbirdJunkFlag = imap.CanonicalFlag("Junk") ThunderbirdNonJunkFlag = imap.CanonicalFlag("NonJunk") )
nolint[gochecknoglobals]
Functions ¶
func AttachPublicKey ¶ added in v1.5.6
func BuildEncrypted ¶
func BuildMIMEBody ¶ added in v1.5.6
BuildMIMEBody builds mime body from the parser returned by NewParser.
func GetAttachmentHeader ¶
func GetAttachmentHeader(att *pmapi.Attachment, buildForIMAP bool) textproto.MIMEHeader
func GetBodyHeader ¶
func GetBodyHeader(m *pmapi.Message) textproto.MIMEHeader
func GetBoundary ¶
func GetEnvelope ¶
func GetEnvelope(msg *pmapi.Message, header textproto.MIMEHeader) *imap.Envelope
GetEnvelope will prepare envelope from pmapi message and cached header.
func GetHeader ¶
func GetHeader(msg *pmapi.Message) textproto.MIMEHeader
GetHeader builds the header for the message.
func Parse ¶
func Parse(r io.Reader) (m *pmapi.Message, mimeBody, plainBody string, attReaders []io.Reader, err error)
Parse parses RAW message.
func ParseFlags ¶
func ParserWithParser ¶ added in v1.5.6
func ParserWithParser(p *parser.Parser) (m *pmapi.Message, plainBody string, attReaders []io.Reader, err error)
ParserWithParser parses message from Parser without building MIME body.
func SeparateInlineAttachments ¶
func SeparateInlineAttachments(m *pmapi.Message) (atts, inlines []*pmapi.Attachment)
func SetBodyContentFields ¶
func SetBodyContentFields(h *textproto.MIMEHeader, m *pmapi.Message)
func WriteHeader ¶
func WriteHeader(w io.Writer, h textproto.MIMEHeader) (err error)
Types ¶
type BodyStructure ¶
type BodyStructure map[string]*SectionInfo
func DeserializeBodyStructure ¶ added in v1.6.3
func DeserializeBodyStructure(raw []byte) (*BodyStructure, error)
func NewBodyStructure ¶
func NewBodyStructure(reader io.Reader) (structure *BodyStructure, err error)
func (*BodyStructure) GetMailHeader ¶ added in v1.7.0
func (bs *BodyStructure) GetMailHeader() (header textproto.MIMEHeader, err error)
GetMailHeader returns the main header of mail.
func (*BodyStructure) GetMailHeaderBytes ¶ added in v1.7.0
func (bs *BodyStructure) GetMailHeaderBytes(wholeMail io.ReadSeeker) (header []byte, err error)
GetMailHeaderBytes returns the bytes with main mail header. Warning: It can contain extra lines or multipart comment.
func (*BodyStructure) GetSection ¶
func (bs *BodyStructure) GetSection(wholeMail io.ReadSeeker, sectionPath []int) (section []byte, err error)
func (*BodyStructure) GetSectionContent ¶
func (bs *BodyStructure) GetSectionContent(wholeMail io.ReadSeeker, sectionPath []int) (section []byte, err error)
func (*BodyStructure) GetSectionHeader ¶
func (bs *BodyStructure) GetSectionHeader(sectionPath []int) (header textproto.MIMEHeader, err error)
GetSectionHeader returns the mime header of specified section.
func (*BodyStructure) IMAPBodyStructure ¶
func (bs *BodyStructure) IMAPBodyStructure(currentPart []int) (imapBS *imap.BodyStructure, err error)
func (*BodyStructure) Serialize ¶ added in v1.6.3
func (bs *BodyStructure) Serialize() ([]byte, error)
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
NewBuilder creates a new builder which manages the given number of fetch/attach/build workers.
- fetchWorkers: the number of workers which fetch messages from API
- attachWorkers: the number of workers which fetch attachments from API.
- buildWorkers: the number of workers which decrypt/build RFC822 message literals.
NOTE: Each fetch worker spawns a unique set of attachment workers! There can therefore be up to fetchWorkers*attachWorkers simultaneous API connections.
The returned builder is ready to handle jobs -- see (*Builder).NewJob for more information.
Call (*Builder).Done to shut down the builder and stop all workers.
func (*Builder) Done ¶ added in v1.7.0
func (b *Builder) Done()
Done shuts down the builder and stops all workers.
func (*Builder) NewJob ¶ added in v1.7.0
NewJob tells the builder to begin building the message with the given ID. The result (or any error which occurred during building) can be retrieved from the returned job when available.
func (*Builder) NewJobWithOptions ¶ added in v1.7.0
func (b *Builder) NewJobWithOptions(ctx context.Context, api Fetcher, messageID string, opts JobOptions) *BuildJob
NewJobWithOptions creates a new job with custom options. See NewJob for more information.
type JobOptions ¶ added in v1.7.0
type JobOptions struct { IgnoreDecryptionErrors bool // Whether to ignore decryption errors and create a "custom message" instead. SanitizeDate bool // Whether to replace all dates before 1970 with RFC822's birthdate. AddInternalID bool // Whether to include MessageID as X-Pm-Internal-Id. AddExternalID bool // Whether to include ExternalID as X-Pm-External-Id. AddMessageDate bool // Whether to include message time as X-Pm-Date. AddMessageIDReference bool // Whether to include the MessageID in References. }
type SectionInfo ¶ added in v1.6.3
type SectionInfo struct { Header textproto.MIMEHeader Start, BSize, Size, Lines int // contains filtered or unexported fields }