【问题标题】:Azure Logic app : How to Send an Email with one or more attachments after getting the content from Blob storage?Azure 逻辑应用程序:如何在从 Blob 存储中获取内容后发送带有一个或多个附件的电子邮件?
【发布时间】:2021-08-19 16:01:06
【问题描述】:

我想使用 azure logic app get blob contents connector 读取 blob 内容,并使用 azure logic app send email connector通过电子邮件将该内容作为附件发送。

附件可以是一个或多个。

发送邮件需要以下 json 格式的附件数据:

[
  {
    "ContentBytes": "@{body('Get_blob_content')}",
    "Name": "Test"
  }
]

【问题讨论】:

    标签: .net azure azure-blob-storage azure-logic-apps workflow-definition-language


    【解决方案1】:

    您可以将When a blob is added or modified (properties only) (Preview) 添加为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 中有一个切换按钮,可以改为使用输入数组

    将 UI 更改为类似的内容

    此处的输入需要此格式的项目数组

    {
      "Name": "<NameOfFile>",
      "ContentBytes": "<Base64OfFileContent>"
    }
    

    【讨论】:

    • 只是一个更正!附件部分应根据附件数量动态添加
    • 如何为多个容器实现这个?只是创建新流程?
    【解决方案2】:

    对我来说,我必须使用以下格式的数组变量。

    {
      "ContentData": "<Base64OfFileContent>",
      "FileName": "FileName.txt"
    }
    

    我用“FileName”代替“Name”,用“ContentData”代替“ContentBytes”。

    【讨论】:

      猜你喜欢
      • 2022-01-19
      • 2022-01-28
      • 1970-01-01
      • 2020-09-07
      • 1970-01-01
      • 2021-01-30
      • 2019-05-09
      • 2021-09-13
      • 2021-02-18
      相关资源
      最近更新 更多