Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/muzychenko-dev/telegram-mail-bridge/releases/download/v1.3.2/telegram-mail-bridge-1.3.2.zipCopies emails your WordPress site sends through wp_mail() to Telegram chats. Unlimited rules, bots and chats, no account and no paid tier.
- Version: 1.3.1
- Requires: WordPress 6.2+, PHP 7.4+
- Languages: English, Ukrainian
- Website and docs: https://telegram-mail-bridge.muzychenko.dev/
- License: GPL-2.0-or-later
What it does
Every email that goes through wp_mail() - contact forms, bookings, WooCommerce orders, security alerts - is checked against your rules. When a recipient matches, the email is converted to Telegram formatting and posted to the rule's chats. The email itself is delivered as usual: the plugin reads the arguments and never changes them.
- Rules: recipient addresses (
office@example.com,*@example.com,any) → bot → one or more chats. - Several bots: tokens are activated once, checked with
getMeand never shown again or sent to the browser. - Forum topics:
-1001234567890:12posts into topic 12 of a supergroup. - Templates:
{email_subject}{email_message}{email_to}{site_name}{site_url}{date}{time}{attachments}. - Clean conversion: paragraphs, lists, links, tables as
a | b; styles, comments and hidden preheaders removed; long emails split into balanced parts (5 messages at most by default). - Instant delivery: sent on
shutdownafter the response is handed to the visitor. No WP-Cron, no queue. - Tests: "Send test message" posts straight to the chats; "Send test email" goes through
wp_mail()and checks the whole chain. - Log: last 40 deliveries with Telegram's error text and plain-language hints.
- Updates: from GitHub releases, through the usual WordPress update screen.
Install
- Download
telegram-mail-bridge-X.Y.Z.zipfrom Releases or the website. - Plugins → Add New → Upload Plugin → Activate.
- Settings → Telegram Mail Bridge.
Moving from the old tg-mail-bridge folder (1.0-1.2)
Versions before 1.3.0 lived in tg-mail-bridge/. Install 1.3.0 next to it and activate: bots, rules and settings are copied, and the old copy is deactivated automatically so emails are not forwarded twice. Then delete the old plugin - its uninstaller removes only its own tmb_* options.
Set up
- Create a bot with @BotFather (
/newbot), paste the token under Bots and click Activate. - Get the chat ID from @MyChatInfoBot. For a private chat, write to your bot first; for a group, add the bot to it.
- Add a rule: recipient addresses, bot, chat IDs. Click Send test message, then save and click Send test email.
Token in wp-config.php
define( 'TGMB_BOT_TOKEN', '123456789:AA...' );
The bot appears in the list as locked and its token is not stored in the database, so it does not end up in backups or database exports. TMB_BOT_TOKEN from older versions still works.
For developers
// Change the text right before sending.
add_filter( 'tgmb_message_text', function ( $text, $rule, $mail_args ) {
return $text;
}, 10, 3 );
// Skip a particular email.
add_filter( 'tgmb_should_forward', function ( $forward, $rule, $mail_args ) {
return false === strpos( $mail_args['subject'], '[test]' );
}, 10, 3 );
// Most messages per email and chat (default 5).
add_filter( 'tgmb_max_parts', fn () => 3 );
// Turn off update checks against GitHub.
add_filter( 'tgmb_enable_updates', '__return_false' );
// After delivery or failure.
add_action( 'tgmb_sent', function ( $message, $chat_id, $rule, $mail_args ) {}, 10, 4 );
add_action( 'tgmb_failed', function ( $error, $chat_id, $rule, $mail_args ) {}, 10, 4 );
WP-CLI
wp tgmb status # bots (masked) and rules
wp tgmb test 1 # test message to the chats of rule 1
wp tgmb test 1 --mail # real email through wp_mail() to rule 1
wp tgmb log # delivery log
wp tgmb log --clear
Limits
- Only
wp_mail()is seen. Plugins that call a mail service API directly (SendGrid or Mailgun SDKs) bypass it. SMTP plugins are fine. - Attachments are not sent, only their names through
{attachments}. - Email content goes to
api.telegram.organd stays in the chat. The ruleanyalso forwards password reset links - avoid it on client sites. - Masking keeps tokens out of sight, not out of reach: anyone with administrator access can read the database. Use a separate bot per client site.
- Security plugins may flag requests to
api.telegram.org. Add the host to trusted ones.
Data
| Option | Content |
|---|---|
tgmb_settings |
bots (tokens), rules, switches |
tgmb_log |
last 40 deliveries: time, subject, chat, result |
tgmb_const_bot_username |
public name of the wp-config.php bot |
tgmb_imported_legacy |
when settings were copied from tg-mail-bridge |
Nothing is autoloaded. Deleting the plugin removes every tgmb_* option and the update checker state.
Releasing (maintainer notes)
- Bump the version in
telegram-mail-bridge.php(header andTGMB_VERSION), inreadme.txt(Stable tagand Changelog) and in this README. wp i18n make-pot . languages/telegram-mail-bridge.pot --domain=telegram-mail-bridge --exclude=languages,lib,toolsandpython3 tools/make-uk.py.git archive --prefix=telegram-mail-bridge/ -o telegram-mail-bridge-X.Y.Z.zip HEAD- Create a GitHub release with tag
vX.Y.Zand attach that zip. Sites update from the attached zip only; a release without it is ignored.
Author
Ihor Muzychenko - muzychenko.dev
Not affiliated with Telegram.
Releases
2 releases. Each count is every asset in that release; expand a row for the breakdown.