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