76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
.context("[smtp2tg.toml] missing \"api_key\" parameter.\n")?;
let mut recipients = HashMap::new();
for (name, value) in settings.get_table("recipients")
.context("[smtp2tg.toml] missing table \"recipients\".\n")?
{
let value = value.into_int()
.context("[smtp2tg.toml] \"recipient\" table values should be integers.\n")?;
recipients.insert(name.to_lowercase().replace('.', ""), value);
}
let tg = Arc::new(TelegramTransport::new(api_key, recipients, &settings)?);
let fields = HashSet::<String>::from_iter(settings.get_array("fields")
.context("[smtp2tg.toml] \"fields\" should be an array")?
.iter().map(|x| x.clone().into_string().context("should be strings"))
.collect::<Result<Vec<String>>>()?);
|
|
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
.context("[smtp2tg.toml] missing \"api_key\" parameter.\n")?;
let mut recipients = HashMap::new();
for (name, value) in settings.get_table("recipients")
.context("[smtp2tg.toml] missing table \"recipients\".\n")?
{
let value = value.into_int()
.context("[smtp2tg.toml] \"recipient\" table values should be integers.\n")?;
recipients.insert(name.to_lowercase(), value);
}
let tg = Arc::new(TelegramTransport::new(api_key, recipients, &settings)?);
let fields = HashSet::<String>::from_iter(settings.get_array("fields")
.context("[smtp2tg.toml] \"fields\" should be an array")?
.iter().map(|x| x.clone().into_string().context("should be strings"))
.collect::<Result<Vec<String>>>()?);
|