CX · Reference guidecx-platform-mail
PlaygroundDownloadsAboutv0.18.0-pre.1

cx-platform-mail

SMTP and IMAP, server and client cores

Why reach for it

Both halves of mail, each in one call. cx-platform-mail is SMTP and IMAP as a CX program meets them: a submission client that dials, greets, upgrades, authenticates, sends and quits in one verb, a mailbox client that connects and reads by UID in one verb, the two server cores a CX process serves either protocol from, and the SASL registry they share — byte-pinned to the RFC vectors.

The common way a mail client is broken is a step its author forgot, so submit and connect have no steps to forget: there is no separate STARTTLS verb, no login verb, no ENABLE verb. Partial acceptance is a value — submit answers a row per recipient — and the IMAP surface is UID-only, because a sequence number renumbers on every EXPUNGE and a client that computed one is a client about to act on the wrong message.

The server cores decide meaning and open nothing, which is what lets the corpus grade them without a socket: the message terminator and its near-misses, dot-stuffing and its inverse, the RFC 5321 minimums for line, path and recipient counts, size claims that overflow, AUTH refused on a cleartext connection under a TLS policy. sasl carries the mechanism registry for both: PLAIN, OAUTHBEARER and XOAUTH2 emission pinned to the published vectors, the GS2 refusals, and a downgrade — a token offered to a password-only server, or the reverse — refused before a credential is sent.

What it gives you

Three modules: the two protocols, in the platform group, and sasl, a Ring 1 module that keeps its cx-stdlib namespace because a program imports it the same way whichever repository carries it. Each links to the reference page projected from the module's own documentation.

module import it as where it lives reference
imap [?lib 'cx-platform/imap'] Ring 1 · the platform group imap reference
smtp [?lib 'cx-platform/smtp'] Ring 1 · the platform group smtp reference

Try it

The first exchange of RFC 4616 §4, derived by hand in the case and graded byte for byte: the PLAIN initial response for tim, as the wire carries it and as the decoded octets, the two NULs where the standard puts them.

prog.cx

        [?lib 'cx-stdlib/sasl']
[?lib 'cx-stdlib/bytes']
[?let [= $a [sasl-auth mechanism=:plain authcid="tim" secret="tanstaaftanstaaf"]]
      [= $ir [$bytes:to-string-utf8 [$sasl:initial-response $a]]]
  [probe [wire $ir] [clear [$bytes:to-hex [$bytes:from-base64 $ir]]]]]
      
        $ cx prog.cx
[probe [wire AHRpbQB0YW5zdGFhZnRhbnN0YWFm] [clear 0074696d0074616e737461616674616e7374616166]]
      

Fixture sasl-001-plain-rfc4616-tim-vector in deps/cx-core-code/conformance/stdlib/sasl.cxd — replayed against this cx when the page was built.

Status

The mail repository builds on the wire and is built on by the application host; the front door compiles its V module from the pin, and the module's own initialisation registers the two pure server cores with the language, so the core names no product.

fact as the registry records it
ships as binary
status extracted
pinned at b8f1ced0c
builds on cx-platform-net
built on by cx-platform-xap, cx-platform-connector
bundled modules 2
BUILDS ON THIS REPOSITORY · SHIPS BUILT ON BY cx-platform-net cx-platform-mail imap smtp cx-platform-xap cx-platform-connector DRAWN FROM registry/repos.cxd's pins= COLUMN AND registry/modules.cxd WHEN THIS PAGE WAS BUILT
Fig. — what cx-platform-mail plugs into: the repositories it builds on (left), the modules it ships (centre), the repositories that build on it (right) · drawn from registry/repos.cxd, deps.cxd and registry/modules.cxd when this page was built