Documentation
¶
Overview ¶
Package message contains set of tools to convert message between Proton API and IMAP format.
Index ¶
- Constants
- Variables
- func BuildRFC822Into(kr *crypto.KeyRing, decrypted *DecryptedMessage, opts JobOptions, ...) error
- func DecryptAndBuildRFC822(kr *crypto.KeyRing, msg proton.Message, attData [][]byte, opts JobOptions) ([]byte, error)
- func DecryptAndBuildRFC822Into(kr *crypto.KeyRing, msg proton.Message, attData [][]byte, opts JobOptions, ...) error
- func HeaderLines(header []byte) [][]byte
- func SanitizeMessageDate(msgTime int64) time.Time
- type Attachment
- type Body
- type DecryptedAttachment
- type DecryptedMessage
- type JobOptions
- type MIMEBody
- type Message
Constants ¶
View Source
const InternalIDDomain = `protonmail.internalid`
InternalIDDomain is used as a placeholder for reference/message ID headers to improve compatibility with various clients.
Variables ¶
View Source
var ( ErrDecryptionFailed = errors.New("message could not be decrypted") ErrNoSuchKeyRing = errors.New("the keyring to decrypt this message could not be found") )
View Source
var ErrInvalidAttachmentPacket = errors.New("invalid attachment packet")
Functions ¶
func BuildRFC822Into ¶ added in v3.1.0
func BuildRFC822Into(kr *crypto.KeyRing, decrypted *DecryptedMessage, opts JobOptions, buf *bytes.Buffer) error
func DecryptAndBuildRFC822 ¶ added in v3.6.0
func DecryptAndBuildRFC822Into ¶ added in v3.6.0
func HeaderLines ¶
HeaderLines returns each line in the given header.
func SanitizeMessageDate ¶
SanitizeMessageDate will return time from msgTime timestamp. If timestamp is not after epoch the RFC822 publish day will be used. No message should realistically be older than RFC822 itself.
Types ¶
type Attachment ¶
type DecryptedAttachment ¶ added in v3.6.0
type DecryptedMessage ¶ added in v3.6.0
type DecryptedMessage struct {
Msg proton.Message
Body bytes.Buffer
BodyErr error
Attachments []DecryptedAttachment
}
func DecryptMessage ¶ added in v3.6.0
type JobOptions ¶
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.
SanitizeMBOXHeaderLine bool // Whether to ignore header line representing MBOX delimiter
}
type Message ¶
type Message struct {
MIMEBody MIMEBody
RichBody Body
PlainBody Body
Attachments []Attachment
MIMEType rfc822.MIMEType
IsReply bool
Subject string
Sender *mail.Address
ToList []*mail.Address
CCList []*mail.Address
BCCList []*mail.Address
ReplyTos []*mail.Address
References []string
ExternalID string
InReplyTo string
XForward string
}
func ParseAndAllowInvalidAddressLists ¶ added in v3.2.0
ParseAndAllowInvalidAddressLists parses an RFC822 message and allows email address lists to be invalid.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.