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§
- Imap
Config - Connection + credentials for an inbound IMAP server (implicit TLS on the IMAPS port).
- Outgoing
Mail - A message to be sent via
send. - Pop3
Config - Connection + credentials for a legacy POP3S service. POP3 is retrieval only; SMTP remains the outbound transport. Implicit TLS is required so the account password is never sent on a plaintext POP3 connection.
- Pop3
Fetched Message - A message fetched through POP3S before semantic delivery rules decide its final local mailbox and quarantine state.
- Smtp
Config - Connection + credentials for an outbound SMTP submission server (STARTTLS on the submission port).
Functions§
- build_
inbound - Construct an
InboundMessageenvelope for the rules engine. - fetch_
pop3 - Retrieve messages from a traditional POP3S mailbox. POP3 has no portable
UNSEENflag, so this returns the mailbox contents; the caller is expected to persist accepted UIDLs before the next poll. Only implicit TLS is supported—plaintext POP3 would expose the account password. - fetch_
unseen - Fetch the unseen messages from
mailboxon the IMAP server described bycfg(implicit TLS). - send
- Send
mailthrough the SMTP submission server described bycfg(STARTTLS).