Provides an EmailSender with SMTP or test transport, handling email composition and sending.
// Source: https://github.com/chelunfu/qiluo_admin | License: MIT | Copyright 2024 Open
// Provided via justclaw.it.com; keep this notice with the code.
use super::Email;
use crate::common::error::{Error, Result};
use lettre::{
AsyncTransport, Message, Tokio1Executor, Transport,
message::{Mailbox, MultiPart, SinglePart},
transport::smtp::authentication::Credentials,
};
use tracing::info;
#[derive(Clone)]
pub enum EmailTransport {
/// SMTP (Simple Mail Transfer Protocol) transport.
Smtp(lettre::AsyncSmtpTransport<lettre::Tokio1Executor>),
/// Test/stub transport for testing purposes.
Test(lettre::transport::stub::StubTransport),
}
#[derive(Clone)]
pub struct EmailSender {
pub transport: EmailTransport,
/// Default from sender from config
pub default
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key