mail

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package mail contains provider-neutral email normalization and safety rules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatAddresses

func FormatAddresses(addresses []model.Address) string

FormatAddresses returns conventional human-readable mailbox syntax.

func IsAllowedRecipient

func IsAllowedRecipient(addresses []model.Address, allowed map[string]struct{}) bool

IsAllowedRecipient checks all envelope-visible recipients against an allow-list.

func NormalizeSubject

func NormalizeSubject(subject string) string

NormalizeSubject removes repeated reply/forward prefixes and normalizes whitespace.

func ParseAddresses

func ParseAddresses(input string) ([]model.Address, error)

ParseAddresses parses RFC-compatible comma-separated mailbox input and deduplicates it.

func ParseOne

func ParseOne(input string) (model.Address, error)

ParseOne parses one address while preserving a display name.

func ReduceDelivery

func ReduceDelivery(current string, currentAt time.Time, event string, eventAt time.Time) string

ReduceDelivery applies explicit precedence while retaining an existing terminal state.

func References

func References(existing, messageID string) string

References appends a message identifier once while preserving order.

func ReplyAll

func ReplyAll(replyTo, from model.Address, originalTo, originalCC []model.Address, own map[string]struct{}) []model.Address

ReplyAll builds a stable deduplicated recipient set while excluding the mailbox itself.

func ReplySubject

func ReplySubject(subject string) string

ReplySubject returns a display subject with exactly one Re: prefix.

func SanitizeHTML

func SanitizeHTML(input string, resolveCID CIDResolver) (sanitized string, remoteImagesBlocked bool)

SanitizeHTML removes executable/active content and blocks remote image requests.

func TextFromHTML

func TextFromHTML(input string) string

TextFromHTML extracts bounded readable text without exposing markup.

Types

type CIDResolver

type CIDResolver func(string) string

CIDResolver maps an inline content identifier to an authenticated local URL.

Jump to

Keyboard shortcuts

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