Smart Email Sorting – Auto-Sort & Move Emails to Sender-Based Folders

Step 1. Create the Flow with the Desired User's Mailbox.

  • Open Power Automate and click Create to start a new flow.
  • Choose Automated Flow
  • Specify the trigger: When a new email arrives automate actions based on incoming emails.

Step 2. Set Up the Trigger When a New Email Arrives.

  • Once your flow is set up with the correct mailbox, add the trigger action.
  • Action: When a new email arrives (V3).
  • This will trigger the flow whenever a new email arrives in the mailbox.

Step 3. Initialize the Variable for the Folder Name.

Click + New Step → Initialize variable.

Set the following properties

  • Name: FolderName
  • Type: String
  • Value: Assign the value based on the sender's email ID or display name (e.g., @{triggerOutputs()?['headers']?['From']}).

Step 4. Get Inbox ID Using Send HTTP Request.

This step uses the Microsoft Graph API to get the list of folders in the inbox.

Click + New Step → Send an HTTP request to Outlook.

Configure the request

This retrieves all the subfolders inside your inbox.

Step 5. Check If the Folder Exists Using Microsoft Graph API.

Add another Send an HTTP request to Outlook action.

Configure the request

This checks if the folder with the name of the sender’s email exists.

Step 6. Check Folder Existence and Conditional Logic.

Add a Condition action to check if the folder for the sender already exists.

Condition

If the folder is found, proceed to move the email to the destination folder.

If the folder does not exist, create a new folder.

Step 7. If Folder Exists - Move Email.

If the folder exists, use the Move email (V2) action.

Set the Destination Folder ID using the Folder ID from the HTTP response.

Step 8. If Folder Does Not Exist - Create New Folder.

If the folder does not exist, use the Create new folder action.

Under the Inbox, create a new folder with the FolderName variable (based on the sender's email address).

Once the folder is created, use the Folder ID from the newly created folder as the Destination Folder ID.

Step 9. Move the Email to the New or Existing Folder.

Finally, use the Move email (V2) action to move the email to the newly created or existing folder.

below I have attached the workflow image for your reference.

Workflow

Output

Mail