Parsing Emails thru flow (Reading Emails thru flow)

Ending February with Microsoft PowerAutomate(flow) Spell.

One of our team reached us as they have a legacy vbscript that runs on a server (from many years) but now giving them issues.

VB script is calling outlook and processing emails based on what it reads from message body.

I suggested them that if they can share the logic or script then same functionality we may be able to achieve with Microsoft PowerAutomate or thru Powershell script instead of using legacy methods.

Here is what needs to be done:

  • Email will be received in the mailbox with attachment
  • Message body will contain email addresses

  • Need to extract the email address and send email with attachment to them.
  • After that move the item to the processed folder.(optional)

Lets create PowerAutomate flow:

We need to create a trigger “When New email Arrives” and then initialize variables to read the email body.

First variable is to read the email body

Second variable to split the body by Customer Email ID: to get actual data.

split(variables(‘Emailbody’),’Customer Email ID:’)

You can test flow by adding each step after creating so you know what you are getting in variables.

Third variable is to get the email addresses in an array so that these can be used by apply to each loop.


Now you can test flow again and see how the array looks like.

Finally add step Apply to each and a condition that if current items “@”

Condition will find email addresses and start sending email to each customer (you can drag and drop attachment name/attachment content from dynamic content)

Now when the flow will run it will send the emails to the customer with attachment as per the designed logic.

You can add extra step of “move email” to move the processed emails to processed folder.

This post is just an example on how you can use flow to parse thru email and automate the legacy processes in the environment without using single line of code.(some code of flow is definitely required, like split, variables etc)

Thanks for reading..

Tech Wizard




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s