1use schemars::JsonSchema;
2use serde::Deserialize;
3use spring::config::Configurable;
4
5#[derive(Debug, Configurable, Clone, JsonSchema, Deserialize)]
7#[config_prefix = "mail"]
8pub struct MailerConfig {
9 #[serde(flatten)]
11 pub transport: Option<SmtpTransportConfig>,
12 pub uri: Option<String>,
14 #[serde(default = "bool::default")]
16 pub test_connection: bool,
17 #[serde(default = "bool::default")]
20 pub stub: bool,
21}
22
23#[derive(Debug, Clone, JsonSchema, Deserialize)]
24pub struct SmtpTransportConfig {
25 pub host: String,
27 pub port: u16,
29 #[serde(default = "bool::default")]
31 pub secure: bool,
32 pub auth: Option<MailerAuth>,
34}
35
36#[derive(Debug, Clone, JsonSchema, Deserialize)]
38pub struct MailerAuth {
39 pub user: String,
41 pub password: String,
43}