foundation capa

foundation-smtp-transport

Shared host/port/TLS-mode/credentials -> lettre AsyncSmtpTransport<Tokio1Executor> builder, used by infrastructure-smtp and infrastructure-communication

Shared host/port/TLS-mode/credentials -> lettre AsyncSmtpTransport<Tokio1Executor> builder, used by infrastructure-smtp and infrastructure-communication

Tierfoundation
Roleunclassified (baselined)
Pathcrates/foundation/smtp-transport
Edition2021
Targetsfoundation_smtp_transport
Public items2 across 0 modules
Tests6

What it is for

# foundation-smtp-transport

One function: host/port/TLS-mode/credentials -> a lettre AsyncSmtpTransport<Tokio1Executor>. Extracted (Gate 4 review finding, Sprint 3.45 follow-up) because infrastructure-smtp::SmtpSender::new (crates/infrastructure/smtp/src/sender.rs) and infrastructure-communication::smtp::SmtpOutboundSender::new (crates/infrastructure/communication/src/smtp.rs) had independently reimplemented the identical lettre 0.11 transport-builder logic (tokio1-native-tls, same version in both crates already) — two copies meant a TLS/timeout fix to one would not propagate to the other.

Why this crate, not a direct dependency between the two

Both infrastructure-smtp and infrastructure-communication are infrastructure-layer (docs/architecture/layers.toml). This workspace's layer rule (tools-xtask/src/main.rs::allowed_deps) is stricter than "depend only on a lower layer" — a non-tools library crate may depend on foundation ONLY, full stop, even same-layer imports are a violation with no exception list entry available for a new edge. So neither infrastructure crate may depend on the other; the only legal shared home for logic both need is a foundation-layer crate. Hence this crate, not (for example) infrastructure-communication depending on infrastructure-smtp directly.

No I/O happens in build_smtp_transport itself — lettre's SMTP transport connects lazily per send. The one exception is that AsyncSmtpTransportBuilder::build() spawns the connection pool's background task (the pool feature lettre defaults to), which needs a live Tokio reactor even though no network I/O happens yet — same reason both call sites' own construction tests are #tokio::test, not plain #test.

Capabilities

TlsMode

# foundation-smtp-transport

Item
pub enum TlsMode
fn build_smtp_transport(host : & str, port : u16, tls_mode : TlsMode, credentials : Option <Credentials>,) -> Result <AsyncSmtpTransport <Tokio1Executor>, lettre::transport::smtp::Error>

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum TlsModeHow to establish transport security for the SMTP connection
fn build_smtp_transport(host : & str, port : u16, tls_mode : TlsMode, credentials : Option <Credentials>,) -> Result <AsyncSmtpTransport <Tokio1Executor>, lettre::transport::smtp::Error>Build an AsyncSmtpTransport from host/port/TLS-mode/credentials

No pub use re-exports: every item above is declared in this crate.

Boundary

Depends on no other workspace tier.

Shares tier foundation with 27 other crates: foundation-audit-log, foundation-basemodels, foundation-bounded-io, foundation-conversation-closure, foundation-crypto-sign, foundation-decisioning, foundation-encounter-vocabulary, foundation-fs-metadata, … (27 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)foundation
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/foundation/smtp-transport
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
lettre^0.11tokio1-native-tlsnoalways
serde^1derivenoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
serde_json^1noalways
tokio^1fullnoalways
tokio-test^0.4noalways

Build. None.

Depended on by. 2 workspace crates.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_infrastructure_communication["infrastructure-communication"] -->|uses| SELF
  n_infrastructure_smtp["infrastructure-smtp"] -->|uses| SELF
  SELF["foundation-smtp-transport"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
libfoundation_smtp_transport`src/lib.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

2 workspace crates depend on this one: infrastructure-communication, infrastructure-smtp.

Verification

KindCount
Unit tests6
Integration tests0
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root204

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc22
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 2
    "No rustdoc detected" : 0

Metrics

MetricValue
Rust source files1
Source lines166
Code lines86
Public API items2
Public modules0
Tests6
Examples0
Cargo features0
Direct runtime dependencies2
Workspace reverse dependencies2
pie showData
    title Public API by kind
    "enum" : 1
    "function" : 1
pie showData
    title Rust source composition
    "Code" : 86
    "Blank or comment" : 80

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las foundation · Manual