Notifications
Announcements
Trigger: Use the "When a new email arrives" trigger to monitor your inbox or folder and retrieve the email.
Extract Email Address: Add a Compose action and use this expression to extract an email address from the email body: match(outputs('Get_email')?['body'], '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}')
Store in a Variable: Add an "Initialize variable" action, set its type to String, and assign the extracted email address for further use.
{"id":"9ad86403-c34f-4157-9ad9-39f0fb0abfb3","brandColor":"#8C3900","connectionReferences":{"shared_conversionservice":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_conversionservice/connections/shared-conversionser-d8930a92-a0f6-4613-9a72-de0954aa1cff"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Scope_get_email_addresses_from_email_body","operationDefinition":{"type":"Scope","actions":{"Html_to_text":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_conversionservice","operationId":"HtmlToText","apiId":"/providers/Microsoft.PowerApps/apis/shared_conversionservice"},"parameters":{"Content":"@outputs('Compose_email_HTML_body')"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{},"metadata":{"operationMetadataId":"94bf0d05-bbb1-4d55-97f5-ac26ab6247e1"}},"Select_chunk":{"type":"Select","inputs":{"from":"@chunk(toLower(outputs('Html_to_text')?['body']),1)","select":"@if(contains(' @._-0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx',item()),item(),' ')"},"runAfter":{"Html_to_text":["Succeeded"]},"description":"See https://tomriha.com/how-to-convert-array-to-a-string-in-power-automate/","metadata":{"operationMetadataId":"623ec1a2-363e-49f8-ae64-68081cf9247c"}},"Compose_4":{"type":"Compose","inputs":"@body('Filter_array')","runAfter":{"Filter_array":["Succeeded"]},"metadata":{"operationMetadataId":"0afdddb7-2b10-4f7c-9148-69e2a4ac742d"}},"Condition_if_output_of_Compose_4_is_array_with_2_or_more_elements":{"type":"If","expression":{"or":[{"equals":["@empty(outputs('Compose_4'))","@true"]},{"less":["@length(outputs('Compose_4'))",2]}]},"actions":{},"runAfter":{"Compose_4":["Succeeded"]},"else":{"actions":{"Select_addresses":{"type":"Select","inputs":{"from":"@range(1, sub(length(outputs('Compose_4')), 2))","select":"@concat(first(split(outputs('Compose_4')[item()], ' ')),if(empty(last(split(outputs('Compose_4')[item()], ' '))),'',concat(',',last(split(outputs('Compose_4')[item()], ' ')))))\r\n\r\n"},"runAfter":{},"metadata":{"operationMetadataId":"e103cd8c-d4c4-409a-af6f-e2408796db99"}},"Compose_6":{"type":"Compose","inputs":"@split(concat(if(empty(last(split(first(outputs('Compose_4')),' '))),'',concat(last(split(first(outputs('Compose_4')),' ')),'@')),join(union(body('Select_addresses'),body('Select_addresses')),'@'),if(empty(first(split(last(outputs('Compose_4')),' '))),'',concat('@', first(split(last(outputs('Compose_4')),' '))))),',')\r\n","runAfter":{"Select_addresses":["Succeeded"]},"metadata":{"operationMetadataId":"06726d2e-581d-47f0-9295-8505e87f5990"}},"Filter_array_of_addresses":{"type":"Query","inputs":{"from":"@outputs('Compose_6')","where":"@equals(and(contains(item(), '@'), not(startsWith(item(),'@')), not(endsWith(item(),'@'))), true)"},"runAfter":{"Compose_6":["Succeeded"]},"metadata":{"operationMetadataId":"6180c353-0b29-479b-a62d-2b335ca67225"}}}},"metadata":{"operationMetadataId":"1b840c23-c7b4-4ff4-991f-efbe50cd9172"}},"Compose_SMTP_addresses_(comma_delimited)":{"type":"Compose","inputs":"@if(or(empty(outputs('Compose_4')),less(length(outputs('Compose_4')),2)),'',replace(join(union(body('Filter_array_of_addresses'),body('Filter_array_of_addresses')),','),'@@','@'))","runAfter":{"Condition_if_output_of_Compose_4_is_array_with_2_or_more_elements":["Succeeded"]},"metadata":{"operationMetadataId":"950b8dec-1374-45ab-a242-e55fac0500d2"}},"Compose_join":{"type":"Compose","inputs":"@trim(replace(join(body('Select_chunk'),''),' ',' '))","runAfter":{"Select_chunk":["Succeeded"]},"metadata":{"operationMetadataId":"0afdddb7-2b10-4f7c-9148-69e2a4ac742d"}},"Filter_array":{"type":"Query","inputs":{"from":"@split(if(endsWith(outputs('Compose_join'), '@'), substring(outputs('Compose_join'), 0, sub(length(outputs('Compose_join')), 2)), outputs('Compose_join')), '@')","where":"@equals(empty(item()), false)"},"runAfter":{"Compose_join":["Succeeded"]},"metadata":{"operationMetadataId":"034a1301-9d43-407b-ac50-ab4c85188f7e"}}},"runAfter":{"Compose_email_HTML_body":["Succeeded"]},"metadata":{"operationMetadataId":"0d1575e2-63d6-48b2-93d3-e75552e9cea6"}}}
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 538 Super User 2025 Season 2
Tomac 405 Moderator
abm abm 252 Most Valuable Professional