Origin for each line in README.md from check-in aaa78fed23:
880ce86a7f 2026-08-01 1: # smtp2tg 880ce86a7f 2026-08-01 2: 880ce86a7f 2026-08-01 3: SMTP-to-Telegram gateway. Receives emails via SMTP and forwards them to Telegram chats. 880ce86a7f 2026-08-01 4: 880ce86a7f 2026-08-01 5: --- 880ce86a7f 2026-08-01 6: 880ce86a7f 2026-08-01 7: ## Installation 880ce86a7f 2026-08-01 8: 880ce86a7f 2026-08-01 9: ### From source 880ce86a7f 2026-08-01 10: ```bash 880ce86a7f 2026-08-01 11: git clone https://github.com/kworr/smtp2tg 880ce86a7f 2026-08-01 12: cd smtp2tg 880ce86a7f 2026-08-01 13: cargo build --release 880ce86a7f 2026-08-01 14: ``` 880ce86a7f 2026-08-01 15: 880ce86a7f 2026-08-01 16: ## Configuration 880ce86a7f 2026-08-01 17: 880ce86a7f 2026-08-01 18: 1. Create `smtp2tg.toml` (see `smtp2tg.toml.example` for reference). 880ce86a7f 2026-08-01 19: 2. Get a Telegram Bot Token from [@BotFather](https://t.me/BotFather). 880ce86a7f 2026-08-01 20: 3. Get your chat ID (use [@getidsbot](https://t.me/getidsbot) or debug mode in Telegram client). 880ce86a7f 2026-08-01 21: 880ce86a7f 2026-08-01 22: ### Example configuration 880ce86a7f 2026-08-01 23: ```toml 1723b63d69 2026-08-01 24: api_key = "replace-with-your-telegram-bot-token" 880ce86a7f 2026-08-01 25: api_gateway = "https://api.telegram.org" 880ce86a7f 2026-08-01 26: listen_on = "127.0.0.1:1025" 880ce86a7f 2026-08-01 27: fields = ["date", "from", "subject"] 880ce86a7f 2026-08-01 28: domains = ["example.com", "localhost"] 880ce86a7f 2026-08-01 29: 880ce86a7f 2026-08-01 30: default = 0 880ce86a7f 2026-08-01 31: 880ce86a7f 2026-08-01 32: [recipients] 880ce86a7f 2026-08-01 33: "admin@example.com" = 12345678 880ce86a7f 2026-08-01 34: "alerts@example.com" = -10012345678 880ce86a7f 2026-08-01 35: ``` aaa78fed23 2026-08-01 36: aaa78fed23 2026-08-01 37: All recipients are internally lowercased, so `UserName` equals `username`. 880ce86a7f 2026-08-01 38: 880ce86a7f 2026-08-01 39: --- 880ce86a7f 2026-08-01 40: 880ce86a7f 2026-08-01 41: ## Usage 880ce86a7f 2026-08-01 42: 880ce86a7f 2026-08-01 43: ### Run 880ce86a7f 2026-08-01 44: ```bash 880ce86a7f 2026-08-01 45: ./smtp2tg -c /path/to/smtp2tg.toml 880ce86a7f 2026-08-01 46: ``` 880ce86a7f 2026-08-01 47: 880ce86a7f 2026-08-01 48: ### CLI arguments 1723b63d69 2026-08-01 49: 880ce86a7f 2026-08-01 50: | Argument | Description | Example | 880ce86a7f 2026-08-01 51: |---------------|---------------------------|-----------------------| 880ce86a7f 2026-08-01 52: | `-h`, `--help` | Show help | `smtp2tg --help` | 880ce86a7f 2026-08-01 53: | `-c`, `--config` | Path to config file | `smtp2tg -c config.toml` | 880ce86a7f 2026-08-01 54: 880ce86a7f 2026-08-01 55: --- 880ce86a7f 2026-08-01 56: 880ce86a7f 2026-08-01 57: ## Security 880ce86a7f 2026-08-01 58: 880ce86a7f 2026-08-01 59: ### Important 880ce86a7f 2026-08-01 60: - **Recommended usage**: Run on `127.0.0.1` (localhost) only. 880ce86a7f 2026-08-01 61: - If exposing to a network: 880ce86a7f 2026-08-01 62: - **Restrict port access** via firewall. 880ce86a7f 2026-08-01 63: - **Use TLS** (e.g., via `stunnel` or `nginx`). 880ce86a7f 2026-08-01 64: - **Implement authentication** (this software does not provide it). 880ce86a7f 2026-08-01 65: 880ce86a7f 2026-08-01 66: ### Config file permissions 880ce86a7f 2026-08-01 67: Set file permissions to `0600` (owner read/write only): 880ce86a7f 2026-08-01 68: ```bash 880ce86a7f 2026-08-01 69: chmod 600 smtp2tg.toml 880ce86a7f 2026-08-01 70: ``` 880ce86a7f 2026-08-01 71: 880ce86a7f 2026-08-01 72: --- 880ce86a7f 2026-08-01 73: ## How it works 880ce86a7f 2026-08-01 74: 1. A client (e.g., Postfix) sends an email to `listen_on` (e.g., `127.0.0.1:1025`). 880ce86a7f 2026-08-01 75: 2. smtp2tg parses the email and converts it to a Telegram message. 880ce86a7f 2026-08-01 76: 3. The message is sent to the specified chat (or `default` if address is unknown). 880ce86a7f 2026-08-01 77: 880ce86a7f 2026-08-01 78: ### Example: Email → Telegram 880ce86a7f 2026-08-01 79: **Incoming email:** 1723b63d69 2026-08-01 80: ```text 880ce86a7f 2026-08-01 81: From: user@example.com 880ce86a7f 2026-08-01 82: To: admin@example.com 880ce86a7f 2026-08-01 83: Subject: Test 880ce86a7f 2026-08-01 84: 880ce86a7f 2026-08-01 85: Hello, world! 880ce86a7f 2026-08-01 86: ``` 880ce86a7f 2026-08-01 87: 880ce86a7f 2026-08-01 88: **Telegram message:** 1723b63d69 2026-08-01 89: ```html 880ce86a7f 2026-08-01 90: <blockquote expandable> 880ce86a7f 2026-08-01 91: <u><i>Subject:</i></u> <code>Test</code> 880ce86a7f 2026-08-01 92: <u><i>From:</i></u> <code>user@example.com</code> 880ce86a7f 2026-08-01 93: <u><i>Date:</i></u> <code>Mon, 01 Jan 2024 12:00:00 +0000</code> 880ce86a7f 2026-08-01 94: </blockquote> 880ce86a7f 2026-08-01 95: <pre>Hello, world!</pre> 880ce86a7f 2026-08-01 96: ``` 880ce86a7f 2026-08-01 97: 880ce86a7f 2026-08-01 98: --- 880ce86a7f 2026-08-01 99: ## Links 880ce86a7f 2026-08-01 100: - **Original repository**: [http://fs.b1t.name/smtp2tg](http://fs.b1t.name/smtp2tg) 880ce86a7f 2026-08-01 101: - **GitHub Mirror**: [https://github.com/kworr/smtp2tg](https://github.com/kworr/smtp2tg)