Generic MailSender over raw SMTP (RFC 5321/5322) — Postfix relay, SMTP AUTH, SES SMTP interface, selected by config, not per-provider code
| Tier | infrastructure |
| Role | unclassified (baselined) |
| Path | crates/infrastructure/smtp |
| Edition | 2021 |
| Targets | infrastructure_smtp, smtp_send |
| Public items | 0 across 0 modules |
| Tests | 27 |
What it is for
# infrastructure-smtp
Generic foundation_mail_message::MailSender implementation over raw SMTP (RFC 5321/5322), covering any backend reachable by host/port/TLS-mode/credentials: a local Postfix relay, an SMTP-AUTH account like mail.southcitycomputer.com's send side, or Amazon SES's SMTP interface. New code (Sprint 3.45 crate 4, see docs/userstories/sprint-3.45-mail-manager-harvest.md) — no rust-gmail-manager source, since that tool's sending/*.rs was Gmail-API-send-specific, not raw SMTP.
Uses lettre (already vendored in this workspace, at this exact version/feature set, by infrastructure-communication::smtp) rather than hand-rolling the SMTP protocol.
Implements MailSender only — never MailReader — per AC-capability-boundary: SMTP is structurally send-only, so this crate never fake-implements a read method it cannot perform. MailReader for mail.southcitycomputer.com's read side is infrastructure-imap (a separate crate), paired under one logical account at the tools-mail-manager config layer, not here.
Security (Gate 1.5.6)
- SMTP AUTH credentials (
SmtpCredentials) are never logged:
SmtpConfig/SmtpCredentials's Debug impls redact password (see config.rs), and this crate never formats a config or credentials value into a log line.
- Message bodies are never logged above
debug. The onedebug!call
this crate makes (in SmtpSender::send) carries only a recipient count — never an address, subject, or body.
Capabilities
No public items.
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
No public items.
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
SmtpSender | sender::SmtpSender |
{SmtpConfig,SmtpCredentials,TlsMode} | config::{SmtpConfig,SmtpCredentials,TlsMode} |
Boundary
Reaches into foundation.
Shares tier infrastructure with 82 other crates: infrastructure-acquire, infrastructure-adapters-google-calendar, infrastructure-adapters-google-gmail, infrastructure-adapters-google-places, infrastructure-adapters-google-trends, infrastructure-adapters-shodan, infrastructure-adapters-yelp, infrastructure-agent, … (82 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) | infrastructure |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/infrastructure/smtp |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_infrastructure["infrastructure"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-mail-message` | foundation | no | always |
| `foundation-smtp-transport` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
lettre | ^0.11 | tokio1-native-tls | no | always |
serde | ^1 | derive | no | always |
tracing | ^0.1 | — | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
serde_json | ^1 | — | no | always |
tokio | ^1 | full | no | always |
tokio-test | ^0.4 | — | no | always |
Build. None.
Depended on by. 1 workspace crate.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_tools_mail_manager["tools-mail-manager"] -->|uses| SELF SELF["infrastructure-smtp"] SELF -->|runtime| n_foundation_mail_message["foundation-mail-message"] SELF -->|runtime| n_foundation_smtp_transport["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
| Kind | Name | Source |
|---|---|---|
| lib | infrastructure_smtp | `src/lib.rs` |
| test | smtp_send | `tests/smtp_send.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
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | none 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.
Related capabilities
1 workspace crate depends on this one: tools-mail-manager.
Verification
| Kind | Count |
|---|---|
| Unit tests | 20 |
| Integration tests | 7 |
| Examples | 0 |
| Doctests | 0 |
What the tests establish, by name:
auth_failure_maps_to_authentication_error—tests/smtp_send.rsconnection_refused_maps_to_transport_error—tests/smtp_send.rsrejected_recipient_maps_to_other_error—tests/smtp_send.rssend_with_no_recipients_is_rejected_before_any_network_call—tests/smtp_send.rssends_successfully_to_a_no_auth_relay—tests/smtp_send.rssends_with_credentials_and_they_reach_the_wire_correctly—tests/smtp_send.rstransient_failure_maps_to_transport_error—tests/smtp_send.rsconfig_debug_redacts_password_via_nested_credentials—src/config.rsconfig_defaults_to_no_credentials_and_starttls_for_a_bare_relay_config—src/config.rsconfig_round_trips_through_json—src/config.rscredentials_debug_redacts_password—src/config.rstls_mode_serializes_snake_case_and_round_trips—src/config.rsbuild_from_mailbox_rejects_malformed_address—src/message.rsbuild_from_mailbox_with_display_name—src/message.rsbuild_from_mailbox_without_display_name—src/message.rsbuild_message_includes_to_cc_bcc_and_subject—src/message.rsbuild_message_rejects_attachment_with_no_content_loaded—src/message.rsbuild_message_rejects_invalid_to_address—src/message.rsbuild_message_rejects_no_recipients—src/message.rsbuild_message_single_text_part_is_plain_body—src/message.rsbuild_message_text_and_html_becomes_multipart_alternative—src/message.rsbuild_message_with_attachment_produces_multipart_mixed—src/message.rsbuild_message_with_no_body_parts_still_produces_a_valid_message—src/message.rsconstructs_for_tls_mode_implicit_with_credentials_ses_shaped—src/sender.rsconstructs_for_tls_mode_none_no_auth_local_relay—src/sender.rsconstructs_for_tls_mode_start_tls_with_credentials—src/sender.rsrejects_malformed_from_address—src/sender.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 0 | 0 |
Public modules with a //! block | 0 | 0 |
Metrics
| Metric | Value |
|---|---|
| Rust source files | 4 |
| Source lines | 734 |
| Code lines | 495 |
| Public API items | 0 |
| Public modules | 0 |
| Tests | 27 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 6 |
| Workspace reverse dependencies | 1 |
pie showData
title Rust source composition
"Code" : 495
"Blank or comment" : 239
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.