Implemented mail notifications.

This commit is contained in:
2024-02-12 17:17:26 +01:00
parent d18ef72d03
commit 1b6f544e55
9 changed files with 720 additions and 78 deletions
+50 -1
View File
@@ -51,12 +51,58 @@ impl Database {
}
}
#[cfg(feature = "ssr")]
#[derive(Deserialize, Clone)]
pub enum MailTransport {
Smtp,
File
}
#[cfg(feature = "ssr")]
#[derive(Deserialize, Clone)]
pub struct Mailing {
transport: MailTransport,
from: String,
path: Option<String>,
server: Option<String>,
user: Option<String>,
password: Option<String>,
tls: Option<bool>
}
#[cfg(feature = "ssr")]
impl Mailing {
pub fn transport(&self) -> &MailTransport {
&self.transport
}
pub fn from(&self) -> &str {
&self.from
}
pub fn path(&self) -> &Option<String> {
&self.path
}
pub fn server(&self) -> &Option<String> {
&self.server
}
pub fn user(&self) -> &Option<String> {
&self.user
}
pub fn password(&self) -> &Option<String> {
&self.password
}
pub fn tls(&self) -> Option<bool> {
self.tls
}
}
#[cfg(feature = "ssr")]
#[derive(Deserialize)]
pub struct Configuration {
session: Session,
network: Network,
database: Database
database: Database,
mailing: Mailing
}
#[cfg(feature = "ssr")]
@@ -70,6 +116,9 @@ impl Configuration {
pub fn database(&self) -> &Database {
&self.database
}
pub fn mailing(&self) -> &Mailing {
&self.mailing
}
}
#[cfg(feature = "ssr")]