1
2
3
4
5
6
7
8
9
10
11
12
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
-
+
+
+
+
|
//! Simple SMTP-to-Telegram gateway. Can parse email and send them as telegram
//! messages to specified chats, generally you specify which email address is
//! available in configuration, everything else is sent to default address.
use smol_macros::main;
use smol_macros::{
LocalExecutor,
main,
};
use std::{
os::unix::fs::PermissionsExt,
path::Path,
};
use clap::Parser;
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
-
+
|
///
/// # Errors
/// Returns an error if the configuration file is missing, inaccessible,
/// insecure, malformed, or contains invalid required settings.
///
/// # Panics
/// Panics if configuring or serving the SMTP server fails.
async fn main () -> Result<()> {
async fn main (ex: &LocalExecutor<'_>) -> Result<()> {
let args = Args::parse();
let config_file = Path::new(&args.config);
if !config_file.try_exists().stack()? {
bail!("Configuration file not found: {config_file:?}\n\
Hint: Ensure the file exists and the path is correct.");
};
{
|