cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bcsanfilippo
Frequent Visitor

Runtime value doesn't have expected format 'string/email'

Hi all - I've read through the threads for a number of other users who received a similar error when trying to send an email to multiple addresses, but none of those solutions seem to be fixing this for me.

 

In this flow, I'm scheduling a weekly report to send new list items only to the users whose emails are in a dynamic people field. In the start of the flow I get list items and filter for the last 7 days; in one branch I select the most important columns to display, and create an HTML table with that data; in the other branch I get emails from the filtered items, use a union to pare that down to unique emails ('uniqueEmails'; for users who have more than one item assigned), initialize a string variable, and then append the outputs of 'uniqueEmails' to EmailsString.

 

I've been unable to figure out how to get around this string/email format error on my Send an email action. Will someone please help me?

1 ACCEPTED SOLUTION

Accepted Solutions

That looks like an object converted to a string, it'll add the \ before special characters. 'Compose' action does remove those characters automatically, that's why it works fine with it.

I'd take one step back, to the point where you extract the email addresses. I don't think you need the key 'eMail' in there, it would be much easier if you took only the email addresses. If you use 'Select' action to do that, switch to the text mode and take only the emails.

image.png



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

7 REPLIES 7
tom_riha
Super User
Super User

Hello @bcsanfilippo ,

do you append the emails to a string variable including the separator ; ?



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Thanks for your response, @tom_riha . Yes, I have a semicolon after the "current item" dynamic content for emails. Here's a picture of just that action:

 

Append to string variable_error_string-email format.png

 

 

 

 

 

 

 

 

 

And if I peek code on that, I have:

{
    "inputs": {
        "name": "EmailsString",
        "value": "@{items('Append_EmailsString_ApplyToEach')};"
    }
}

Then I'd try to add 'Compose' action right before the email and store the EmailsString variable in there. Just to check what value it has before it enters the 'Send an email'.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Good thought.. so in a Compose, it's showing input:

"{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};"

and output:

"{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};"

 

(actual email addresses replaced with EMAIL@EMAIL in these snippets, of course)

 

I'm not seeing any difference.. but when testing this flow with a Compose action instead of a Send an Email action it runs successfully. When I add the Send an Email action back in... flow fails. Same error that it's not seeing this as format 'string/email'.

 

I'm stumped!

That looks like an object converted to a string, it'll add the \ before special characters. 'Compose' action does remove those characters automatically, that's why it works fine with it.

I'd take one step back, to the point where you extract the email addresses. I don't think you need the key 'eMail' in there, it would be much easier if you took only the email addresses. If you use 'Select' action to do that, switch to the text mode and take only the emails.

image.png



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

I need to read up on why exactly this worked, but it did... I changed my getEmails (Select) action to text mode and mapped to the dynamic email content - flow runs successfully! Thank you!

 

Removed_key_in_select_RUN SUCCESS.png

bcsanfilippo
Frequent Visitor

Oh, reading comprehension... you already explained to me why that key mapping matters!

 

For anyone reading through this thread in their own searches, when I used a key in the Select action instead of just mapping directly to the dynamic content, my output was

"{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};{\"eMail\":\"EMAIL@EMAIL\"};"

 

but when I mapped directly to the dynamic content, my output was

"EMAIL@EMAIL;EMAIL@EMAIL;EMAIL@EMAIL;EMAIL@EMAIL;EMAIL@EMAIL;"

 

It's the extra key identifier garbage that was throwing a formatting error. Thanks again, @tom_riha !

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,485)