email/sendmail/
config.rs

1//! Module dedicated to the sendmail sender configuration.
2//!
3//! This module contains the configuration specific to the sendmail
4//! sender.
5
6use once_cell::sync::Lazy;
7use process::Command;
8
9pub static SENDMAIL_DEFAULT_COMMAND: Lazy<Command> =
10    Lazy::new(|| Command::new("/usr/bin/sendmail"));
11
12/// The sendmail sender configuration.
13#[derive(Clone, Debug, Default, Eq, PartialEq)]
14#[cfg_attr(
15    feature = "derive",
16    derive(serde::Serialize, serde::Deserialize),
17    serde(rename_all = "kebab-case")
18)]
19pub struct SendmailConfig {
20    /// The sendmail command.
21    pub cmd: Option<Command>,
22}
23
24impl SendmailConfig {
25    pub fn cmd(&self) -> &Command {
26        self.cmd.as_ref().unwrap_or(&*SENDMAIL_DEFAULT_COMMAND)
27    }
28}