逻辑应用程序(从数据库中读取 EmailID 并发送电子邮件)

时间:2021-06-29 20:02:36

标签: azure azure-logic-apps

假设我在 SQL 表中有两行,列分别为 Email、Record1、Record2。

现在如果'xyz@outlook.com'在表中有两行,

电子邮件|记录1|记录2

xyz@outlook.com|测试1|测试2 xyz@outlook com|Test3|Test4

如何将电子邮件发送到“xyz@outlook.com”,“电子邮件正文”为 ,所有行都属于该电子邮件 ID。

注意:我只需要将电子邮件中的“收件人”读作动态值

表格:

电子邮件。记录1。记录2


xyz@outlook.com。测试 1 测试 2

xyz@outlook.com。测试3。测试4

应向 xyz@outlook com 发送一封电子邮件,并在两行中​​提供详细信息。

1 个答案:

答案 0 :(得分:0)

请参考我下面的示例:

我在 sql 中有一个表(名为“电子邮件”),如下图所示:

enter image description here

在逻辑应用中,我创建了一个操作“Get row(V2)”来获取表格的一行。

enter image description here

然后您可以使用表达式 substring(body('Get_row_(V2)')?['email'], 0, indexOf(body('Get_row_(V2)')?['email'], '|'))xyz@outlook.com 获取电子邮件地址 xyz@outlook.com|Test1|Test2

enter image description here

============================更新================ ============

关于您描述的更新,请参考我的样本。

我有一张如下图所示的表格:

enter image description here

在逻辑应用程序中,我使用“获取行(V2)”来获取表的行。

enter image description here

然后在发送电子邮件时使用表达式 body('Get_rows_(V2)')?['value'][0]?['email'] 作为 To 字段的值。

enter image description here

在发送电子邮件的 Body 中,使用四个表达式:

body('Get_rows_(V2)')?['value'][0]?['Record1']
body('Get_rows_(V2)')?['value'][0]?['Record2']
body('Get_rows_(V2)')?['value'][1]?['Record1']
body('Get_rows_(V2)')?['value'][1]?['Record2']