Documentation
¶
Overview ¶
Package email is the gateway's email channel: a dedicated mailbox the agent answers. IMAP (SSL :993) is polled for unseen mail; replies go out over SMTP (STARTTLS :587) with proper threading headers. The model is a DEDICATED account (an app password for Gmail/Outlook), never your personal inbox — the bot answers everything its allow-list admits.
Ack semantics match the gateway contract: a message is marked \Seen ONLY after Deliver returns nil, so a crash between fetch and durable record just re-fetches it. The durable dedup key is <mailbox>/<UIDVALIDITY>/<UID> — the provider-side identity, robust against malformed or duplicated Message-IDs (which serve threading, not dedup).
IDENTITY CAVEAT: the principal is the RFC From address — weaker than the other channels' platform-authenticated ids, since From can be spoofed by mail that evades the provider's SPF/DKIM/DMARC filtering. The mailbox provider's authentication is the real gate (a mainstream provider rejects or junks spoofed mail before we poll it), which is one more reason for the dedicated-account model. Enforcing Authentication-Results=pass explicitly is a tracked follow-up.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel is an email (IMAP+SMTP) connection.
func New ¶
func New(address, password, imapHost, smtpHost string, poll time.Duration, mediaDir string) *Channel
New builds an email channel. poll <= 0 uses the default (15s). mediaDir is the gateway media spool inbound attachments are saved into; "" disables attachment handling.