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 Apps / Sending Email via Powe...
Power Apps
Answered

Sending Email via PowerApp Issue

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

When sending an email via PowerApps using templates we have in Dynamics, it's sending the XML to Outlook and not the HTML of the email. How can I get that to pass back the HTML?

 

See screenshot.

powerappss.png
Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Could you please share a bit more about your Office365.SendEmail() formula?

     

    Based on the screenshot that you mentioned, the result the emailtemplate.Selected.Body formula returned is a XML structure data (<?xml vresion = "1.0" ... >) rather than a valid HTML strucure data.

     

    If you want the XML structure data to be rendered as a valid HTML strucure data in your email body, I afraid that there is no way to achieve your needs in PowerApps currently.

     

    As an alternative solution, you could consider remove the XML tag from the result the emailtemplate.Selected.Body formula, then type the extracted text within your Office365.SendEmail() formula.

     

    I have made a test on my side, please take a try with the following workaround:

    Set the OnSelect property of the "Send Email" button to following:

    Office365.SendEmail(
    User().Email,
    "PowerApps Email Subject",
    substitute(
    Substitute(emailtemplate.Selected.Body, "<?xml version=""1.0"" ?><xsl:stylesheet xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" version=""1.0""><xsl:output method=""text"" indent=""no""/><xsl:template match=""/data""><![CDATA[", ""),
    "]]><xsl:choose><xsl:when test=""systemuser/fullname""><xsl:value-of select=""systemuser/fullname"" ... >",
    ""
    ),
    {IsHtml: true}
    )

    Note: The <?xml version=""1.0"" ?><xsl:stylesheet xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" version=""1.0""><xsl:output method=""text"" indent=""no""/><xsl:template match=""/data""><![CDATA[ represents the XML tag before the HTML data in your emailtemplate.Selected.Body formula result.

    The ]]><xsl:choose><xsl:when test=""systemuser/fullname""><xsl:value-of select=""systemuser/fullname"" ... > represents the XML tag after the HTML data in your emailtemplate.Selected.Body formula result.

     

    Please consider take a try with above alternative solution, then check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks so much for the feedback! However, that did not work. I also tried something similar myself with the following expression to remove the xml and it didn't render the html (just removed the xml text and displayed html text):

    Office365.SendEmail(inputTo_1.Text, inputSubject_1.HtmlText, Right(inputBody_1.HtmlText, Len(inputBody_1.HtmlText)-177),{Importance: "Normal"})

     

    Any other thoughts?

     

    Thanks.

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Could you please share more details about the extracted HTML text that you mentioned?

     

    Please consider modify your formula as below:

    Office365.SendEmail(
    inputTo_1.Text,
    inputSubject_1.HtmlText,
    Right(inputBody_1.HtmlText, Len(inputBody_1.HtmlText)-177),
    {
    Importance: "Normal",
    IsHtml: true /* <-- Add this formula */
    }
    )

    Please consider modfy your formula as above, then check if the issue is solved.

     

    Best regards,

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard