parser

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package parser implements MSG file parsing. It extracts headers and body from Outlook MSG files (OLE2/MAPI format), outputting the same JSON schema as eml-to-jsonl for pipeline compatibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename string `json:"filename"`
	MIMEType string `json:"mime_type"`
	Size     int    `json:"size"`
}

Attachment holds metadata for an attached file.

type BodyPart

type BodyPart struct {
	Type    string `json:"type"`
	Content string `json:"content"`
}

BodyPart represents a single decoded body section.

type Email

type Email struct {
	Source      string       `json:"source"`
	MessageID   string       `json:"message_id,omitempty"`
	InReplyTo   string       `json:"in_reply_to,omitempty"`
	From        string       `json:"from,omitempty"`
	To          []string     `json:"to,omitempty"`
	CC          []string     `json:"cc,omitempty"`
	BCC         []string     `json:"bcc,omitempty"`
	Subject     string       `json:"subject,omitempty"`
	Date        string       `json:"date,omitempty"`
	XMailer     string       `json:"x_mailer,omitempty"`
	Received    []string     `json:"received,omitempty"`
	Encoding    string       `json:"encoding,omitempty"`
	Body        []BodyPart   `json:"body"`
	Attachments []Attachment `json:"attachments"`
}

Email is the structured representation of a parsed MSG message. The schema is intentionally identical to eml-to-jsonl's output.

func Parse

func Parse(data []byte, source string) (*Email, error)

Parse reads raw MSG file bytes and returns a structured Email. source is recorded as-is in the Source field (e.g. a file path or "stdin").

Jump to

Keyboard shortcuts

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