Azure Logic 应用程序:如何在从 Blob 存储中获取内容后发送带有一个或多个附件的电子邮件? [英] Azure Logic app : How to Send an Email with one or more attachments after getting the content from Blob storage?
问题描述
我想使用 azure logic app get blob contents connector 读取 blob 内容,并使用 azure logic app send email connector 通过电子邮件将该内容作为附件发送.
附件可以是一个或多个.
发送电子邮件需要以下json格式的附件数据:
<预><代码>[{"ContentBytes": "@{body('Get_blob_content')}",名称":测试"}]You can add When blob is added or modified (properties only) (Preview)
as trigger
专注于您想要收听的 Container
.
然后添加 Get blob content
作为 action
以获取 blob 内容.
最后添加 Send email
作为向用户发送电子邮件的操作.在这里我选择 Gmail
并且因为你添加了 Get blob content
动作,所以在 Attachments Content
列中你可以插入 File Content
等于 @{base64(body('Get_blob_content'))}
.
如果要添加一个或多个附件,只需在Send email
操作中点击Add new item
即可.
这是设计器屏幕截图和代码视图屏幕截图.
<小时>为了将动态数量的文件附加到电子邮件中,UI 中有一个切换按钮可以改为使用输入数组
将用户界面更改为这样的内容
此处的输入需要此格式的项目数组
<代码>{"Name": "","ContentBytes": " "}
I want to read blob contents using azure logic app get blob contents connector and send that contents as attachment via email using azure logic app send email connector.
Attachments could be one or more.
Send email requires attachment data in following json format :
[
{
"ContentBytes": "@{body('Get_blob_content')}",
"Name": "Test"
}
]
You could add When a blob is added or modified (properties only) (Preview)
as trigger
to focus on the Container
which you want to listen to.
Then add Get blob content
as action
to get the blob content.
Finally add Send email
as action to sent email to users. Here I choose Gmail
and as you have add Get blob content
action, so in Attachments Content
column you could insert File Content
which is equal to @{base64(body('Get_blob_content'))}
.
If you want to add one or more attachment, you only need to click Add new item
in Send email
action.
Here is designer screenshot and code view screenshot.
For attaching a dynamic number of files to an email, there is a toggle in the UI to use an input array instead
which changes the UI to something like this
The input here expects an array of items in this format
{
"Name": "<NameOfFile>",
"ContentBytes": "<Base64OfFileContent>"
}
这篇关于Azure Logic 应用程序:如何在从 Blob 存储中获取内容后发送带有一个或多个附件的电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!