Origin for each line in README.md from check-in 1723b63d69:
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: unknown = "relay" 880ce86a7f 2026-08-01 28: fields = ["date", "from", "subject"] 880ce86a7f 2026-08-01 29: domains = ["example.com", "localhost"] 880ce86a7f 2026-08-01 30: 880ce86a7f 2026-08-01 31: default = 0 880ce86a7f 2026-08-01 32: 880ce86a7f 2026-08-01 33: [recipients] 880ce86a7f 2026-08-01 34: "admin@example.com" = 12345678 880ce86a7f 2026-08-01 35: "alerts@example.com" = -10012345678 880ce86a7f 2026-08-01 36: ``` 880ce86a7f 2026-08-01 37: 880ce86a7f 2026-08-01 38: To catch bounces (so they wouldn't stuck in upper mail server) make sure sender 880ce86a7f 2026-08-01 39: envelope address is real as required by mail library (actually not sure whether 880ce86a7f 2026-08-01 40: this applies to mailin). For example Postfix has to be tweaked like this: 880ce86a7f 2026-08-01 41: 880ce86a7f 2026-08-01 42: $config_directory/main.cf: 880ce86a7f 2026-08-01 43: smtp_generic_maps = hash:$config_directory/generic 880ce86a7f 2026-08-01 44: 880ce86a7f 2026-08-01 45: $config_directory/generic: 880ce86a7f 2026-08-01 46: "" postmaster@example.com 880ce86a7f 2026-08-01 47: <> postmaster@example.com 880ce86a7f 2026-08-01 48: 880ce86a7f 2026-08-01 49: Actually not sure which one works... 880ce86a7f 2026-08-01 50: 880ce86a7f 2026-08-01 51: --- 880ce86a7f 2026-08-01 52: 880ce86a7f 2026-08-01 53: ## Usage 880ce86a7f 2026-08-01 54: 880ce86a7f 2026-08-01 55: ### Run 880ce86a7f 2026-08-01 56: ```bash 880ce86a7f 2026-08-01 57: ./smtp2tg -c /path/to/smtp2tg.toml 880ce86a7f 2026-08-01 58: ``` 880ce86a7f 2026-08-01 59: 880ce86a7f 2026-08-01 60: ### CLI arguments 1723b63d69 2026-08-01 61: 880ce86a7f 2026-08-01 62: | Argument | Description | Example | 880ce86a7f 2026-08-01 63: |---------------|---------------------------|-----------------------| 880ce86a7f 2026-08-01 64: | `-h`, `--help` | Show help | `smtp2tg --help` | 880ce86a7f 2026-08-01 65: | `-c`, `--config` | Path to config file | `smtp2tg -c config.toml` | 880ce86a7f 2026-08-01 66: 880ce86a7f 2026-08-01 67: --- 880ce86a7f 2026-08-01 68: 880ce86a7f 2026-08-01 69: ## Security 880ce86a7f 2026-08-01 70: 880ce86a7f 2026-08-01 71: ### Important 880ce86a7f 2026-08-01 72: - **Recommended usage**: Run on `127.0.0.1` (localhost) only. 880ce86a7f 2026-08-01 73: - If exposing to a network: 880ce86a7f 2026-08-01 74: - **Restrict port access** via firewall. 880ce86a7f 2026-08-01 75: - **Use TLS** (e.g., via `stunnel` or `nginx`). 880ce86a7f 2026-08-01 76: - **Implement authentication** (this software does not provide it). 880ce86a7f 2026-08-01 77: 880ce86a7f 2026-08-01 78: ### Config file permissions 880ce86a7f 2026-08-01 79: Set file permissions to `0600` (owner read/write only): 880ce86a7f 2026-08-01 80: ```bash 880ce86a7f 2026-08-01 81: chmod 600 smtp2tg.toml 880ce86a7f 2026-08-01 82: ``` 880ce86a7f 2026-08-01 83: 880ce86a7f 2026-08-01 84: --- 880ce86a7f 2026-08-01 85: ## How it works 880ce86a7f 2026-08-01 86: 1. A client (e.g., Postfix) sends an email to `listen_on` (e.g., `127.0.0.1:1025`). 880ce86a7f 2026-08-01 87: 2. smtp2tg parses the email and converts it to a Telegram message. 880ce86a7f 2026-08-01 88: 3. The message is sent to the specified chat (or `default` if address is unknown). 880ce86a7f 2026-08-01 89: 880ce86a7f 2026-08-01 90: ### Example: Email → Telegram 880ce86a7f 2026-08-01 91: **Incoming email:** 1723b63d69 2026-08-01 92: ```text 880ce86a7f 2026-08-01 93: From: user@example.com 880ce86a7f 2026-08-01 94: To: admin@example.com 880ce86a7f 2026-08-01 95: Subject: Test 880ce86a7f 2026-08-01 96: 880ce86a7f 2026-08-01 97: Hello, world! 880ce86a7f 2026-08-01 98: ``` 880ce86a7f 2026-08-01 99: 880ce86a7f 2026-08-01 100: **Telegram message:** 1723b63d69 2026-08-01 101: ```html 880ce86a7f 2026-08-01 102: <blockquote expandable> 880ce86a7f 2026-08-01 103: <u><i>Subject:</i></u> <code>Test</code> 880ce86a7f 2026-08-01 104: <u><i>From:</i></u> <code>user@example.com</code> 880ce86a7f 2026-08-01 105: <u><i>Date:</i></u> <code>Mon, 01 Jan 2024 12:00:00 +0000</code> 880ce86a7f 2026-08-01 106: </blockquote> 880ce86a7f 2026-08-01 107: <pre>Hello, world!</pre> 880ce86a7f 2026-08-01 108: ``` 880ce86a7f 2026-08-01 109: 880ce86a7f 2026-08-01 110: --- 880ce86a7f 2026-08-01 111: ## Links 880ce86a7f 2026-08-01 112: - **Original repository**: [http://fs.b1t.name/smtp2tg](http://fs.b1t.name/smtp2tg) 880ce86a7f 2026-08-01 113: - **GitHub Mirror**: [https://github.com/kworr/smtp2tg](https://github.com/kworr/smtp2tg)