Skip to main content

Crate puerto_correo

Crate puerto_correo 

Source
Expand description

Puerto’s mail runtime (ADR-0020): what every generated mail shares. A project declares one port per mail in its domain (EnviadorCorreoBienvenida); the implementation renders that mail’s Plantillas and hands the puerto_nucleo::correo::Correo to a EnviadorCorreoSmtp. A worker consumer sends it through enviar_una_vez(), so a redelivered event does not send it twice.

Re-exports§

pub use config::ConfigCorreo;
pub use config::ErrorConfigCorreo;
pub use enviar_una_vez::enviar_una_vez;
pub use plantillas::Plantillas;
pub use smtp::EnviadorCorreoSmtp;

Modules§

config
The mail configuration, read once at startup from the environment (and .env).
enviar_una_vez
The step a worker consumer sends a mail through (ADR-0020 § 4): at-least-once delivery in, one mail out — or, if the process dies between the send and the mark, two. Never none.
plantillas
A mail’s templates: subject.txt, body.html and the optional body.txt, embedded by the generated code with include_str! and rendered with minijinja.
smtp
The SMTP adapter of EnviadorCorreo: lettre over tokio and rustls, with pooled connections.

Structs§

Correo
One message, rendered: who it goes to and what it says. The sender is the EnviadorCorreo’s.

Enums§

ErrorCorreo
Why a message was not sent, as far as a caller needs to know: whether trying again can help.

Traits§

CorreosEnviados
Which mails went out for which event: what keeps an at-least-once delivery from sending the same mail twice. Keyed by the event’s id and the mail’s name.
EnviadorCorreo
Sends a rendered message. puerto_correo::EnviadorCorreoSmtp in a project, a recording fake in tests.