Check-in [aaa78fed23]
Logged in as anonymous
Overview
Comment:drop dot removal (wrong), document lowercasing
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aaa78fed23d8a7c23e6559f9c8a979e73c0cd58cf5ec4c7a5251f2744c969be3
User & Date: arcade on 2026-08-01 19:29:41.377
Other Links: manifest | tags
Context
2026-08-01
19:32
and fix tests leaf check-in: 40a93e9a58 user: arcade tags: trunk
19:29
drop dot removal (wrong), document lowercasing check-in: aaa78fed23 user: arcade tags: trunk
18:47
ensure!() we don't panic but instead return Result whenever possible, convert error handling a little, add TODO for unwrap(), more sanity checks, simplify and expand testing check-in: 98c5a42df0 user: arcade tags: trunk
Changes
Modified README.md from [4b74daffcc] to [3481cdb912].
29
30
31
32
33
34
35


36
37
38
39
40
41
42
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44







+
+








default = 0

[recipients]
"admin@example.com" = 12345678
"alerts@example.com" = -10012345678
```

All recipients are internally lowercased, so `UserName` equals `username`.

---

## Usage

### Run
```bash
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
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);
			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>>>()?);
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105







-
+







	///
	/// # Returns
	/// * `Result<&ChatPeerId>` - Chat ID if found.
	///
	/// # Errors
	/// Returns an error if `name` is not configured.
	pub fn get (&self, name: &str) -> Result<&ChatPeerId> {
		self.recipients.get(&name.to_lowercase().replace('.', ""))
		self.recipients.get(&name.to_lowercase())
			.with_context(|| format!("Recipient \"{name}\" not found in configuration"))
	}

	/// Sends a text message to a specified chat.
	///
	/// # Arguments
	/// * `to` - Target chat ID.