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

Send an Email V2 String passing variable error

Hi, I'm having a strange issue passing email addresses via a variable. 

 

I have three flows which all use an initialise variable then apply to each to combine user Emails from a SharePoint person column into a single output seperated by semi colons for Send an Email V2 to use. 

 

On two flows this works fine and the same method is used to combine several other multiple choice values to ensure only on email is needed. 

 

on one flow however this method will not work, i keep getting the following message. 

 

"The 'inputs.parameters' of workflow operation 'Send_an_email_(V2)' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'emailMessage/To' is required to be of type 'String/email'. The runtime value '"\nJBLOGGS@123.com;\JDOE@123.com;"' to be converted doesn't have the expected format 'string/email'."

 

I've checked the three flows and they are identical. 

 

Can anybody give me some guidance as to why one Send and Email V2 likes it but another doesn't? 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @codecheck ,

I think.it's because of the new line you use when you're building the list of email addresses. Keep them all on the same line, just separate them by ; .



[ 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

4 REPLIES 4
tom_riha
Super User
Super User

Hello @codecheck ,

the emails string in the error message seems strange, it should be just email addresses separated by semicolons, without the \ and \n. I'd check the part where you build the string with addresses for some typo.

JBLOGGS@123.com;JDOE@123.com;


[ 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. ]

That was my first thought but i cant see any reason why the variable is different to others. 

codecheck_0-1621522034650.png

What's odder is the input passed to send an email in this flow seems different to another. 

 

flow with error: 

{
    "host": {
        "connectionReferenceName""shared_office365_1",
        "operationId""SendEmailV2"
    },
    "parameters": {
        "emailMessage/To""\nJBLOGS@123.com;\nJDOE@123.com;",
        "emailMessage/Subject""Skip Defect Reported - Test Site ",
        "emailMessage/Body""<p>Hello, <br>\n<br>\nA Skip Defect has been identififed at Test Site, the Defects identified are: \nDoor Tie Back, please view the images here PageType=4&ListId=7febd4b5%2D407d%2D4bb5%2Dba3b%2Dd7b4c694b9ce&ID=5&ContentTypeID=0x0100FF9A91CEDA2D484590477FFF8122605A002440DA16E6DB6E42B51AC2C7F028C0A0>Here</a> <br>\n<br>\nThe Site has rated the severity as Amber<br>\n<br>\nThank You,<br>\n<br>\nSkip Defect Reporting Service&nbsp;</p>",
        "emailMessage/From""123&123.com",
        "emailMessage/ReplyTo""DBLOGS@123.com"
    }
}
 
Flow that works fine:
 
{
    "method""post",
    "path""/v2/Mail",
    "host": {
        "api": {
            "runtimeUrl""https://uk-001.azure-apim.net/apim/office365"
        },
        "connection": {
            "name""/providers/Microsoft.PowerApps/apis/shared_office365/connections/27858a3df7fbc05d4e9119c5119ce0d711"
        }
    },
    "authentication": {
        "scheme""Key",
        "parameter""*sanitized*",
        "type""Raw"
    },
    "body": {
        "To""\JBLogs@123.com;\nJDOE@123.com;",
        "Subject""Incident Reported at Site",
        "Body""<p>A Incident has been recorded at Site, on the 19/05/2021 at 16:28 and an accident form has been sent to site.<br>\n<br>\nThe full Details of the report can be found here: LINK PageType=4&ListId=2040ca70%2Deffa%2D4d62%2Db6c9%2D0e55c949da30&ID=21&ContentTypeID=0x0100589F1A0BC0496349A1354F664727E7A900584C05D976C1974090D0B74ACA4D8835<br>\n<br>\nThank you,<br>\n<br>\nPlaace&nbsp;Accident Notification Service</p>",
        "From""123@123.com",
        "Cc""1234@123.com;LBLOGS@123.com",
        "ReplyTo""LBLOGS@123.com;123@123.com;",
        "Importance""High"
    }
}
 
Both are send an email V2, the only difference is the faulty flow was made in the last 2 months while the one that works is from the start of the year. 

Hello @codecheck ,

I think.it's because of the new line you use when you're building the list of email addresses. Keep them all on the same line, just separate them by ; .



[ 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, that seems to work. although Powerapps Notification V2 didn't like them being passed to it that way. no issue though as an apply to each getting the managers email from the sharepoint list will work fine for that bit. 

 

Odd that it would work fine on other flows though. 

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 (4,772)