1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
//! 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.
mod mail;
mod telegram;
mod utils;
use crate::mail::MailServer;
use async_compat::Compat;
use just_getopt::{
OptFlags,
OptSpecs,
|
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//! 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.
mod mail;
mod telegram;
mod utils;
#[cfg(test)]
mod tests;
use crate::mail::MailServer;
use async_compat::Compat;
use just_getopt::{
OptFlags,
OptSpecs,
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
let mut args = std::env::args();
args.next();
let parsed = specs.getopt(args);
for u in &parsed.unknown {
println!("Unknown option: {u}");
}
if !(parsed.unknown.is_empty()) || parsed.options_first("help").is_some() {
println!("SMTP2TG v{}, (C) 2024 - 2025\n\n\
\t-h|--help\tDisplay this help\n\
\t-c|--config …\tSet configuration file location.",
env!("CARGO_PKG_VERSION"));
return Ok(());
};
let config_file = Path::new(if let Some(path) = parsed.options_value_last("config") {
&path[..]
|
|
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
let mut args = std::env::args();
args.next();
let parsed = specs.getopt(args);
for u in &parsed.unknown {
println!("Unknown option: {u}");
}
if !(parsed.unknown.is_empty()) || parsed.options_first("help").is_some() {
println!("SMTP2TG v{}, (C) 2024 - 2026\n\n\
\t-h|--help\tDisplay this help\n\
\t-c|--config …\tSet configuration file location.",
env!("CARGO_PKG_VERSION"));
return Ok(());
};
let config_file = Path::new(if let Some(path) = parsed.options_value_last("config") {
&path[..]
|