Skip to main content

Module mail_transport

Module mail_transport 

Source
Expand description

SMTP send + IMAP fetch transport for the semantic mail client.

This module is the network edge for mail: it puts bytes on the wire (SMTP over STARTTLS) and pulls unseen messages off it (IMAP over implicit TLS). It deliberately does not make delivery decisions — those belong to the pure rules layer in crate::mail_rules. The bridge between the two is build_inbound, a pure function that constructs the crate::mail_rules::InboundMessage envelope the rules engine consumes; the IMAP path uses it to turn each fetched message into something crate::mail_rules::evaluate can rule on.

Network functions are gated #[cfg(not(target_arch = "wasm32"))] — there is no raw-socket SMTP/IMAP on the wasm32 target, so only the pure surface (SmtpConfig, ImapConfig, OutgoingMail, build_inbound) compiles there.

All fallible network functions map their underlying errors to String so callers get a flat, transport-agnostic error surface.

Structs§

ImapConfig
Connection + credentials for an inbound IMAP server (implicit TLS on the IMAPS port).
OutgoingMail
A message to be sent via send.
SmtpConfig
Connection + credentials for an outbound SMTP submission server (STARTTLS on the submission port).

Functions§

build_inbound
Construct an InboundMessage envelope for the rules engine.
fetch_unseen
Fetch the unseen messages from mailbox on the IMAP server described by cfg (implicit TLS).
send
Send mail through the SMTP submission server described by cfg (STARTTLS).