cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RomanMelekh
New Member

Save attachnements based on TO field

Hello ALL

I am a newbie in the Power Automate world but have experience working with PowerShell so I thought it could help me. But I was wrong 🙂 I was looking for some debug options but did not find anything that could help me in my case.

 

The situation: 

I have a mailbox, dba@contoso.com; and source1@contoso.com and source2@contoso.com.

Both source1 and source2 redirect emails to dba@contoso.com.

Depending on the original mailbox, I need to save attachments in Folder1 or Folder2.

There should not be a problem but it is.

I have a "Condition" block that always returns "false". I have tried to use the e-mail address and Display Name. The result is the same. 

 

RomanMelekh_1-1651611930438.png

Could you help me to figure out how could I save attachments based on the TO field?

Thank you very much in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you for explaining @RomanMelekh 🙂

 

I think i was confused about forwarding and redirecting 🙂

 

If it is being redirected then what you are doing is correct. My earlier solution works when emails are getting forwarded .

 

To help debug the issue i recommend create two compose action and adding To (from dynamic content) in one of those and adding From (from dynamic content) in the second compose action.

Screenshot 2022-05-04 010639.png

Then once you run/test your flow go and check the flow run values

2022-05-04_1-09-05.png

This should help

 

let me know if that does not help

View solution in original post

6 REPLIES 6
Anonymous_Hippo
Super User
Super User

Hello @RomanMelekh 

I am little bit confused but let me know if i am assuming this correctly.

 

You are forwarding all emails sent to  source1@contoso.com and source2@contoso.com. To dba@contoso.com.

 

Now you are setting up the flow on dba@contonso.com 's inbox . You would like to differentiate the attachments that were sent to source1 and source2.

 

If this is the scenario then you can do this. You need to be looking at the FROM column since this email is getting forwarded 🙂

Flow.png

 

 

 

Hopefully this help !!!

 

 

 

RomanMelekh
New Member

Hi!
Probably I was in hurry and did not provide more details 🙂

Sorry about that.

 

The real scenario is that:

 

I have 4 mailboxes: mysql@contoso.commssql@contoso.com, oracle@contoso.com and postgresql@contoso.com

Each mailbox redirects (M365 setting) everything to dba@contoso.com

Now, users can send emails to those 4 mailboxes with attachments (SQL scripts) and I need to save those attachments in different folders.

 

The flow:

person1@contoso.com wants the DBA team to run their script on MSSQL.

person1@contoso.com   sends an email to mssql@contoso.com (because their script is for MSSQL)

mssql@contoso.com redirects to dba@contoso.com 

My flow, attached to dba@contoso.com should understand that the original email was intended to mssql@contoso.com and should save all the attachments to Root\MSSQL folder on dba's OneDrive. 

 

So, I need to utilize TO, not FROM, but Power Automate always returns "false" if I create CONDITION like "if TO=mssql do ....."

 

 

Thank you for explaining @RomanMelekh 🙂

 

I think i was confused about forwarding and redirecting 🙂

 

If it is being redirected then what you are doing is correct. My earlier solution works when emails are getting forwarded .

 

To help debug the issue i recommend create two compose action and adding To (from dynamic content) in one of those and adding From (from dynamic content) in the second compose action.

Screenshot 2022-05-04 010639.png

Then once you run/test your flow go and check the flow run values

2022-05-04_1-09-05.png

This should help

 

let me know if that does not help

Hi

 

I have added two Compose blocks and TO shows exactly the email I am sending to.

It seems like it is working (at least, worked once) if I copy-paste the value from the Compose block. Weird 🙂

The difference is just upper-lower case 

 

@RomanMelekh 

 

Great ! There is a small chance that your condition had space in it. Also I do have faced similar annoying glitches when everything was right but the flow simply did not like to run. Removing and readding things normally fixes it- it would have been convenient to give it a slight whack - that's how i used to fix all my old electronic appliances LOL

 

Glad it works now . Have a nice day

 

Cheers!! 

that's how i used to fix all my old electronic appliances - you have made my day 🙂

Thank you very much for your help and support, it seems like the "Compose" block forces PA to do what the user is asking it to do 🙂

 

 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (6,115)