message

package
v1.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2021 License: GPL-3.0 Imports: 30 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppleMailJunkFlag      = imap.CanonicalFlag("$Junk")
	ThunderbirdJunkFlag    = imap.CanonicalFlag("Junk")
	ThunderbirdNonJunkFlag = imap.CanonicalFlag("NonJunk")
)

nolint[gochecknoglobals]

Functions

func AttachPublicKey added in v1.5.6

func AttachPublicKey(p *parser.Parser, key, keyName string)

func BuildEncrypted

func BuildEncrypted(m *pmapi.Message, readers []io.Reader, kr *crypto.KeyRing) ([]byte, error)

func BuildMIMEBody added in v1.5.6

func BuildMIMEBody(p *parser.Parser) (mimeBody string, err error)

BuildMIMEBody builds mime body from the parser returned by NewParser.

func CustomMessage

func CustomMessage(m *pmapi.Message, decodeError error, attachBody bool) error

func GetAttachmentHeader

func GetAttachmentHeader(att *pmapi.Attachment) textproto.MIMEHeader

func GetBodyHeader

func GetBodyHeader(m *pmapi.Message) textproto.MIMEHeader

func GetBoundary

func GetBoundary(m *pmapi.Message) string

func GetEnvelope

func GetEnvelope(m *pmapi.Message) *imap.Envelope

func GetFlags

func GetFlags(m *pmapi.Message) (flags []string)

func GetHeader

func GetHeader(msg *pmapi.Message) textproto.MIMEHeader

GetHeader builds the header for the message.

func GetRelatedBoundary

func GetRelatedBoundary(m *pmapi.Message) string

func GetRelatedHeader

func GetRelatedHeader(m *pmapi.Message) textproto.MIMEHeader

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 ParseFlags(m *pmapi.Message, flags []string)

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 WriteAttachmentBody

func WriteAttachmentBody(w io.Writer, kr *crypto.KeyRing, m *pmapi.Message, att *pmapi.Attachment, r io.Reader) (err error)

func WriteBody

func WriteBody(w io.Writer, kr *crypto.KeyRing, m *pmapi.Message) error

func WriteHeader

func WriteHeader(w io.Writer, h textproto.MIMEHeader) (err error)

Types

type BodyStructure

type BodyStructure map[string]*sectionInfo

func NewBodyStructure

func NewBodyStructure(reader io.Reader) (structure *BodyStructure, err error)

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)

func (*BodyStructure) IMAPBodyStructure

func (bs *BodyStructure) IMAPBodyStructure(currentPart []int) (imapBS *imap.BodyStructure, err error)

func (*BodyStructure) Parse

func (bs *BodyStructure) Parse(r io.Reader) error

type Builder

type Builder struct {
	EncryptedToHTML bool
	// contains filtered or unexported fields
}

Builder for converting PM message to RFC822. Builder will directly write changes to message when fetching or building message.

func NewBuilder

func NewBuilder(client pmapi.Client, message *pmapi.Message) *Builder

NewBuilder initiated with client and message meta info.

func (*Builder) BuildMessage

func (bld *Builder) BuildMessage() (structure *BodyStructure, message []byte, err error)

BuildMessage converts PM message to body structure (not RFC3501) and bytes of RC822 message. If successful the original PM message will contain decrypted body.

func (*Builder) SuccessfullyDecrypted

func (bld *Builder) SuccessfullyDecrypted() bool

SuccessfullyDecrypted is true when message was fetched and decrypted successfully

func (*Builder) WriteAttachmentBody

func (bld *Builder) WriteAttachmentBody(w io.Writer, att *pmapi.Attachment, attReader io.Reader) (err error)

WriteAttachmentBody decrypts and writes the attachments

func (*Builder) WriteBody

func (bld *Builder) WriteBody(w io.Writer) error

WriteBody decrypts PM message and writes main body section. The external PGP message is written as is (including attachments)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL