Reputation: 145
I am trying to create a flow in Power Automate which reads a csv file from azure blob and convert it to EML format as defined by RFC 2822 then attach that to email and send to a recipient.
The part that I am stuck at is creating the eml wrapper once I read the content of the file
Is there any action in power automate flow that can do this?
Upvotes: 0
Views: 226
Reputation: 11383
I do agree with @Skin, Alternatively, I would suggest you to Azure Logic apps and you can use below approach:
Design:
Here I taken CSV data directly, you can take it from Azure Blob storage:
JavaScript Code:
const rithcsv =workflowContext.actions.Compose.outputs;
const rows = rithcsv.trim().split('\n').map(row => row.split(','));
const headers = rows.shift();
const data = rows.map(row => {
const rithobj = {};
headers.forEach((header, i) => rithobj[header] = row[i]);
return rithobj;
});
const ritheml = `
${data.map(row => `${row.Test} ${row.Body} ${row.OtherField}`).join('\n')}
`;
return ritheml;
Then:
Output:
Upvotes: 0