Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
482 views
in Technique[技术] by (71.8m points)

.net - Azure Logic app : How to Send an Email with one or more attachments after getting the content from Blob storage?

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"
  }
]
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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. enter image description here enter image description here


For attaching a dynamic number of files to an email, there is a toggle in the UI to use an input array instead

toggle-for-dynamic-input

which changes the UI to something like this

dynamic-attachments-input

The input here expects an array of items in this format

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...