Skip to main content

Module console

Module console 

Source
Available on crate feature email only.
Expand description

Console transport implementation.

This backend writes a human-friendly representation of emails to stdout. It is intended primarily for development and testing environments where actually sending email is not required.

Typical usage is through the high-level crate::email::Email API.

§Examples

use cot::common_types::Email;
use cot::email::EmailMessage;
use cot::email::transport::console::Console;

let email = cot::email::Email::new(Console::new());
let recipients = vec![Email::try_from("testrecipient@example.com").unwrap()];
let msg = EmailMessage::builder()
    .from(Email::try_from("no-reply@example.com").unwrap())
    .to(vec![Email::try_from("user@example.com").unwrap()])
    .build()?;
email.send(msg).await?;

Structs§

Console
A transport backend that prints emails to stdout.

Enums§

ConsoleError
Errors that can occur while using the console transport.