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

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Problems making a draft email from html

(0) ShareShare
ReportReport
Posted on by 10

Heya,

 

Beginner Power Automate user here, I'm trying to extract data from an email to put in a new draft email ready to be sent.

The outputs(OT/NAME/USER) I place back in a existing HTML to fit the format.

This all works well until I get to the http request, to make the draft email.

using this guide:

create a draft outlook - from damobird365 

 

I'm able to make a plain text draft just fine, but with the output (HTML BODY) gathered it comes up with the following error:

Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format.

Stonker_0-1707569951337.png

 

 

I've looked around and it seems the quotes/or the HTML format might be the problem, but any method i've tried the replace the quotes don't seem to work for me.

Passing HTML content as a variable to build a JSON 

 

Where in the flow do I exactly replace this? I've tried:

replace(variables('HTML_body')'"''"')

 

I understand the basic replace function, but whenever I use the replace function the content comes up as empty.

Where in my current flow should I change the HTML in my flow, or should I apply a different flow entirely.

Stonker_1-1707570153930.png

 

 

 

I have the same question (0)
  • harshdeol Profile Picture
    412 Moderator on at
    Re: Problems making a draft email from html

    Hi @Stonker , 

    Can you please share the screenshot of what you are passing in the content. I believe it is Email Body, Correct? Can you please share the screenshot of HTML Body, please.

    harshdeol_0-1707572065475.png

     

     

    -----------------------------------------------------------------------------------------------------------------
    If your question got an answer, please click "Accept as Solution "✅, If you liked my answer, please hit the "thumbs-up" 👍button.

    Thank you,
    Harsh Deol

  • Stonker Profile Picture
    10 on at
    Re: Problems making a draft email from html

    Hi Harsh,

     

    Thanks for your quick reply to my post, the HTML input I'm using is quite long. over 60000 character and seems to exceed the number characters allowed in a private message, maybe that's part of the problem?

    Should I only be adding HTML body to content: " "

    Stonker_0-1707572942654.png

    start of the HTML Body:

    Stonker_1-1707573237076.png

     

     

    I

  • VictorIvanidze Profile Picture
    12,839 on at
    Re: Problems making a draft email from html

    Try to use 

    replace(variables('HTML_body'), '"', '\"')
  • Stonker Profile Picture
    10 on at
    Re: Problems making a draft email from html

    Hi Victor,

     

    I get the following error:

    Stonker_0-1707573943596.png

    Did is misplace this command?

  • harshdeol Profile Picture
    412 Moderator on at
    Re: Problems making a draft email from html

    Hi @Stonker ,

    In the expression of Compose Action, you're using the variables('HTML_body') instead of output of HTML body.

    Please try by replacing this with:

    outputs('HTML_body')

    harshdeol_0-1707643398011.png

    -----------------------------------------------------------------------------------------------------------------
    If your question got an answer, please click "Accept as Solution "✅, If you liked my answer, please hit the "thumbs-up" 👍button.

    Thank you,
    Harsh Deol

  • Stonker Profile Picture
    10 on at
    Re: Problems making a draft email from html

    Hi Harsh,

    Thanks for your reply, now it does go through and replace the Quotes:

    Stonker_0-1707645028296.png

    But it still gives the same error:

    Stonker_1-1707645071717.png

     

  • VictorIvanidze Profile Picture
    12,839 on at
    Re: Problems making a draft email from html

    Don't use empty Subject. Also please show the whole JSON request payload.

  • Stonker Profile Picture
    10 on at
    Re: Problems making a draft email from html

    In an attempt to change/hide data being input from the e-mail, something else broke:

    I get this error now even with the emails that worked before, mind you I only changed the triggered parameters a bit (from requirement, repair it to previous parameters doesn't fix this error.

     

     

    It currently gives the following error:

    The execution of template action 'For_each' failed: the result of the evaluation of 'foreach' expression '@triggerOutputs()?['body/value']' is of type 'Null'. The result must be a valid array.

    Stonker_0-1707660300468.png

     

    Rebuilding the flow and not tampering with the trigger parameters seems to help.

    Regardless I've sent you the slightly edited HTML in a private message, hope this helps 🙂

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 722 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 461 Moderator

#3
developerAJ Profile Picture

developerAJ 283

Last 30 days Overall leaderboard