Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
Address represents a single email address with an optional display name.
func MustAddr ¶
MustAddr parses an address like "Ada <ada@example.com>" or "ada@example.com". Panics on error. Use in examples or tests.
Parameters:
- s: The address string to parse.
Returns:
- Address: The parsed address.
func ParseAddress ¶
ParseAddress parses a single address string into Address.
Parameters:
- s: The address string to parse.
Returns:
- Address: The parsed address.
- error: An error if the address string is invalid.
func ParseAddressList ¶
ParseAddressList parses a header-like list into []Address.
Parameters:
- list: The list of address strings to parse.
Returns:
- []Address: The parsed addresses.
- error: An error if the address list is invalid.
type Attachment ¶
type Attachment struct {
Filename string // file name to present in email client
ContentType string // e.g. "application/pdf"
ContentID string // set to serve as inline image "cid:<ContentID>"
Reader io.Reader // streamed content
}
Attachment represents a file attachment or inline image.
type DKIMConfig ¶
DKIMConfig enables DKIM signing (rsa-sha256, relaxed/relaxed). Headers lists which header field names to include in "h=" in order. Use lowercase names (e.g. "from", "to", "subject").
type Hooks ¶
type Hooks struct {
OnBuildStart func(ctx context.Context, msg *Message) context.Context
OnBuildDone func(ctx context.Context, msg *Message, size int,
err error)
OnAttemptStart func(ctx context.Context, attempt int) context.Context
OnAttemptDone func(ctx context.Context, attempt int, err error)
}
Hooks allows you to integrate tracing/metrics without extra deps. Return a derived context from Start hooks if you want to carry spans.
type Message ¶
type Message struct {
From Address
To []Address
Cc []Address
Bcc []Address
Subject string
Plain []byte // optional
HTML []byte // optional
Attach []Attachment
Headers map[string]string
TrackingID string
}
Message is the high-level representation of an email.
func (*Message) CloneHeaders ¶
CloneHeaders returns a shallow copy safe for per-send mutation.
func (*Message) RecipientList ¶
RecipientList returns combined To+Cc+Bcc for envelope use.