13

利用Power Automate推送域名邮箱中不存在用户的邮件到Telegram

 3 years ago
source link: https://blog.landon.li/2021/05/23/%E5%88%A9%E7%94%A8power-automate%E6%8E%A8%E9%80%81%E5%9F%9F%E5%90%8D%E9%82%AE%E7%AE%B1%E4%B8%AD%E4%B8%8D%E5%AD%98%E5%9C%A8%E7%94%A8%E6%88%B7%E7%9A%84%E9%82%AE%E4%BB%B6%E5%88%B0telegram/?amp%3Butm_medium=rss&%3Butm_campaign=%25e5%2588%25a9%25e7%2594%25a8power-automate%25e6%258e%25a8%25e9%2580%2581%25e5%259f%259f%25e5%2590%258d%25e9%2582%25ae%25e7%25ae%25b1%25e4%25b8%25ad%25e4%25b8%258d%25e5%25ad%2598%25e5%259c%25a8%25e7%2594%25a8%25e6%2588%25b7%25e7%259a%2584%25e9%2582%25ae%25e4%25bb%25b6%25e5%2588%25b0telegram
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
本文最后更新于 282 天前,其中的信息可能已经有所发展或是发生改变。

本文记录了配置 Microsoft Power Automate,将 Office 365 域名邮箱接收到的发往域中不存在用户的邮件推送到 Telegram 的过程。

前提条件是配置好 Office 365 域名邮箱,并拥有管理员账户,本文中不再赘述。

配置 Exchange

首先需要将所有发往域中不存在用户的邮件转发给指定用户,以下是操作步骤:

管理员用户登录 Exchange 管理界面

添加用户组

选择 Dynamic distribution

设置 group 邮件地址

添加 Mail flow 规则

此时,发往域中不存在用户的邮件都会转发到上面 Assign Users 步骤中设置的 Owner 的邮箱。

配置 Power Automate

目前 Microsoft Power Automate 提供数百种连接器,但可惜的是没有我想用的 Telegram 的连接器。所以我们需要设置一个自定义的连接器,通过 Telegram Bot API 将消息发往 Telegram。

Telegram Bot 的设置有很多教程,本文中不再赘述,下文会假设读者已获得 bot_tokenchat_id

创建自定义连接器

填写常规信息

安全性中选择无身份验证

定义中先填写常规信息

再选择请求中的从示例导入

谓词选择 POST

URL 如下方填写,注意将 <bot_token> 替换成真实的值。后面的 <chat_id><text> 在此处只是演示,可不用替换

 https://api.telegram.org/bot<bot_token>/sendMessage?parse_mode=HTML&chat_id=<chat_id>&text=<text>

测试中新建连接并填入 sendMessage 所需参数可测试此自定义连接器是否配置正确

按顺序添加并设置如下图的三个步骤

至此就全部配置完毕,接下来可以开始检验配置成果了。

编写一封发往域中不存在用户的邮件

可以看到,之前设置的 Owner 很快就能收到这封邮件

并且,邮件的详情会被推送到 Telegram


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK