models

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const AttachmentPrefix = "__attach_"

Variables

This section is empty.

Functions

func CleanAndAcceptBodyCandidate added in v1.1.5

func CleanAndAcceptBodyCandidate(input string, minLen int) (string, bool)

CleanAndAcceptBodyCandidate cleans the input and returns it if it is a valid body candidate.

func ValidateEmailList added in v1.1.2

func ValidateEmailList(emailList string) bool

ValidateEmailList validates a comma-separated list of email addresses

Types

type Attachment added in v1.1.1

type Attachment struct {
	Name string
}

type Message

type Message struct {
	MessageClass            string                // PR_MESSAGE_CLASS
	MessageID               string                // PR_INTERNET_MESSAGE_ID
	Subject                 string                // PR_SUBJECT
	FromEmail               string                // PR_SENDER_EMAIL_ADDRESS
	FromName                string                // PR_SENDER_NAME
	ToDisplay               string                // PR_DISPLAY_TO
	To                      string                // PR_DISPLAY_TO
	CCDisplay               string                // PR_DISPLAY_CC
	BCCDisplay              string                // PR_DISPLAY_BCC
	CC                      string                // PR_DISPLAY_CC
	BCC                     string                // PR_DISPLAY_BCC
	BodyPlainText           string                // PR_BODY
	BodyHTML                string                // PR_HTML
	ConvertedBodyHTML       string                // The body in HTML format (converted from RTF)
	Headers                 string                // Email headers (if available)
	Date                    time.Time             // PR_MESSAGE_DELIVERY_TIME
	ClientSubmitTime        time.Time             // PR_CLIENT_SUBMIT_TIME
	CreationDate            time.Time             // PR_CREATION_TIME
	LastModificationDate    time.Time             // PR_LAST_MODIFICATION_TIME
	Attachments             []Attachment          // Attachments
	Properties              map[int64]interface{} // Other properties
	TransportMessageHeaders string                // Message Headers
	Address                 []string              // Email Address
	LastRecipient           int                   // Last recipient of the message
	// contains filtered or unexported fields
}

Message is a struct that holds a structered result of parsing the entry

func (*Message) CalculateFinalBody added in v1.1.5

func (res *Message) CalculateFinalBody()

CalculateFinalBody selects the best HTML or plain text body from the candidate arrays.

Reasoning: - If any HTML candidates are present, the longest one is chosen as BodyHTML (HTML is preferred for fidelity). - If no HTML is present but plain text candidates exist, the longest one is chosen as BodyPlainText. - If neither is present, both fields remain empty. This approach ensures the richest available content is used, and avoids short/empty/partial bodies.

func (*Message) HandleAttachment added in v1.1.1

func (res *Message) HandleAttachment(entry *mscfb.File)

HandleAttachment processes and stores attachment information

func (*Message) SetProperties

func (res *Message) SetProperties(msgProps MessageEntryProperty)

SetProperties sets the message properties and collects body/html candidates

type MessageEntryProperty added in v1.1.1

type MessageEntryProperty struct {
	Class string
	Mapi  int64
	Data  interface{}
}

MessageEntryProperty holds information about a property of a message entry in the msg file

Jump to

Keyboard shortcuts

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