as-milano/wn-mailtelegram-plugin

Plugin, allows to receive site emails in your Telegram account via bot.

Installs: 29

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Forks: 0

Type:winter-plugin

dev-master 2022-07-16 15:50 UTC

This package is auto-updated.

Last update: 2024-04-16 16:48:58 UTC


README

Mail Telegram plugin allows to receive site mail to your telegram account via bot. You can log all email sent on the website or configure this plugin to receive only notification emails for particular administrator(s). See the documentation for configuration details.

Installation

Composer

Use Composer to add plugin to your project:

composer require as-milano/wn-mail-telegram-plugin

Documentation

Full documentation about telegram bots, you can see here: https://core.telegram.org/bots/api

Get bot token

Create bot by @BotFather. Bot token will look like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11

Get user chat id

For getting user chat id - write any message to bot or just click Start. Then you can go to Mail Telegram settings and in Receivers tab you'll see your telegram user ID. Second way you can get your user's ID - open the following url in your browser:

https://api.telegram.org/bot{{token}}/getUpdates

Don't forget to replace {{token}} with your bot token.

Enter this token and chat id into plugin settings. That is all, have a nice experience with this plugin!

Other settings

Disabled in debug

You can disable telegram notifications in debug mode.

Disabled sending mail to Telegram

You can disable telegram notifications at all.

Admins to send mail

If you check admin1 - only those mail that has "To" parameter set to admin1's e-mail will be sent to the Telegram chat.

Formatting tab

Strip ends of lines

Make notification mail text compact by stripping ends of lines. That will transform the mail text into one paragraph.

Send messages to several bots.

In your plugin you can create your own Telegram objects with other telegram tokens. Then use the logic from classes/Helper class - send method. Just copy the code, ajust it and send messages your way.

$telegram = (new Telegram(['telegram_token' => $sToken]));

License

Originally developed by Art Gek.

Inspired by Exception Report to Telegram by Alexander Shapoval