email

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

func (*Channel) Name

func (c *Channel) Name() string

Name returns the adapter identifier.

func (*Channel) Send

func (c *Channel) Send(ctx context.Context, conversation string, msg channels.Outbound) error

Send replies to a peer over SMTP, threading into the remembered conversation when one is known. Email has no length cap, so no chunking.

func (*Channel) Start

func (c *Channel) Start(ctx context.Context, sink channels.Sink) error

Start polls the mailbox until ctx is cancelled. Connection errors back off exponentially (capped) instead of returning, so a flaky mail server never takes the gateway down.

Jump to

Keyboard shortcuts

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