web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / retrieve mailaddres fr...
Power Automate
Answered

retrieve mailaddres from an array with 'select'

(0) ShareShare
ReportReport
Posted on by 8
I have a SP list which I filter based on certain criteria. I use the criteria for a condition and based on the output of the condition I would like to send an mail. The mailaddress is an object in the array of 'Verantwoordelijke(n)' (translate as "accountable") as you can see in picture 1.
I've used a 'Compose' action to retrieve the array of the 'Verantwoordelijke(n)' and a 'Select' action to retrieve the mailaddress. Ths works fine, but the output of the 'Select' action returns the mailadres with double quotes and brackets. If I use the output in a 'Send an email (V2)' action then I get an error: 
originalMessage""At least one recipient is not valid., Recipient '[\"jane.doe@dummy.nl\"]' is not resolved. All recipients must be resolved before a message can be submitted.".
 
How can I retrieve the mailaddress in a way I can use it for sending an email?
 
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Lagortinez Profile Picture
    130 Moderator on at

    Hi there!

    Are you expecting multiple email addresses in that array? If not, you can safely extract just one using this Power FX expression:

    if(empty(outputs('Compose_-_Verantwoordelijke')), '', first(outputs('Compose_-_Verantwoordelijke')))
    

    This checks if the array is empty—if it is, it returns an empty string; otherwise, it retrieves the first item. That way, you avoid any runtime errors when the array has no values.

    And, if you're inside a for each, you can Append to a String Variable, and just do on the dynamic content the same PowerFX Formula followed after by a ','. That will let you at the end with a big string of email addresses looking like this: 'email1'at'test.com,email2'at'test.com,' and the last thing you would need to remove the last comma (unnecesary), with a PowerFX Formula like: 

    substring(variables('RecipientEmailsCSV'), 0, sub(length(variables('RecipientEmailsCSV')), 1))
    
    Assuming that RecipientEmailsCSV is your variable name, otherwise replace it 😉

    If this post helped you, please click "Does this answer your question?" and give it a like to help others in the community find the answer too!

    José Martínez Lago

    Solution Architect | Dynamics 365 & Power Platform

    Empowering low-code consultants to deliver high-impact solutions

    🔗 Blog: thatsagoodquestion.info
    🔗 LinkedIn: martinezlago

  • AgnesB Profile Picture
    8 on at
    Hello @Lagortinez,
     
    Thank you for your quick reply,
    I'm sorry but I can't get my head around your solution.

    I want to retrieve the mailaddress from the item in the 'apply to each'. Below a screenshot of my flow after the 'Condition' action.
    If i use a 'append to string variable' in the 'Apply to Each' I need to have a 'Initialize Variable' outside the 'Apply to Each. 
    The problem is that the 'Select mailadres' action returns the mailadres, but with square brackets and double quotes: ["jane.doe'at'dummy.nl"]
     
  • Verified answer
    Pstork1 Profile Picture
    69,121 Most Valuable Professional on at
    Your problem is that the output of a Select is always an array, even if it only contains one item.  But you are using it like a string.  That's where the square brackets come from.  If you put the output of the select in a first() function you will get the first email in the list as a string.  That should solve the problem of the square brackets and the quotes.  If the quotes are still an issue then put that output inside a replace() function to remove the quotes.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • AgnesB Profile Picture
    8 on at
    Thank you both for your quick reply! I solved the issue by adding an 'compose' action where I use the expression: 
    first(body('Select_mailadres')) and it works!

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.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard