Documentation
¶
Overview ¶
Package mime provides MIME message parsing using enmime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StripHTML ¶
StripHTML removes HTML tags, decodes entities, and normalizes whitespace. Block elements are converted to line breaks for readable plain text output.
Note: Preformatted content (<pre>, <code>) loses its whitespace formatting as all runs of spaces are collapsed. This is acceptable for email preview where preserving exact code formatting is less important than readability.
Types ¶
type Address ¶
type Address struct {
Name string
Email string
Domain string // Extracted from email for aggregation
}
Address represents an email address with optional display name.
type Attachment ¶
type Attachment struct {
Filename string
ContentType string
ContentID string
Size int
ContentHash string // SHA-256 of content
Content []byte
IsInline bool
}
Attachment represents a file attachment or inline part.
type Message ¶
type Message struct {
Subject string
Date time.Time
From []Address
To []Address
Cc []Address
Bcc []Address
ReplyTo []Address
MessageID string
InReplyTo string
References []string
BodyText string
BodyHTML string
Attachments []Attachment
Errors []string // Non-fatal parsing errors
}
Message represents a parsed email message.
func (*Message) GetBodyText ¶
GetBodyText returns the best available body text. Prefers plain text, falls back to stripped HTML.
func (*Message) GetFirstFrom ¶
GetFirstFrom returns the first From address, or empty if none.