PowerApps Button – MailTo Link with big html body

  • PowerApps Button – MailTo Link with big html body

    Posted by DSC Communities on December 27, 2021 at 3:00 am
    • Fabian Heil

      Member

      December 27, 2021 at 3:00 AM

      Hi,

      i want to open a new email via MailTo Link on a button in my PowerApp.
      When i test it with a simple body, it works fine. But when i use a complex html content, the button does not work.
      It doesnt bring any error, but when clicking it, it doesnt open an email.


      The html field contains some text and a table with concated values from a collection.
      Do i need to change anything in the html to make it work in a mailto link?

      ——————————
      Fabian Heil
      ——————————

    • Larry Heimendinger

      Member

      December 28, 2021 at 1:21 PM

      I have an app that sends out a very complex HTML email.Ā  Here’s how I compose the HTML text and then send it via a Power Automate:

      1. I created a new screen and added two objects:Ā  HTML text and a label.
      2. I I set the MTMLText property to be the <label.text >where label is the name of the label object.
      3. In the text value for the label field, I have this:

      4. Ā Notice that within the HMTL text above, there are CONCAT(<colname>).Ā  When the app has all the data, it creates or patches these collections, the app takes actions like those below (lots more, but this is to illustrate only):

        ClearCollect(colHTMLLines,
        “<table style=’border:1px solid black; border-collapse:collapse; width=’100%’ border=’1′ cellpadding=’5′>
        <tr style=background-color:grey>
        <th>Item No</th>
        <th> Desc </th>
        <th>UM </th>
        <th> Qty Ordered </th>
        <th> Qty Picked</th>
        <th> Qty Verified</th>
        <th> Amount</th>

        );

        ForAll(colLineItems,
        If(!IsBlank(Desc) , // if Desciption not blank add to collection
        Collect(colHTMLLines, “<tr><td>” & ItemRef_FullName & “</td><td>” & Desc & “</td><td>” & UnitofMeasure & “</td><td style=””text-align:right””>” & Quantity & “</td><td style=””text-align:right””>” & ‘QTY Picked’ & “</td><td style=””text-align:right””>” & ‘Delivered Qty’ & “</td></tr>” & “</td><td style=””text-align:right””>” & Text(Amount, “$0.00”) & “</td></tr>” )
        )
        );
        Collect(colHTMLLines,”</Table>”); // Add to collection to complete <table> entry

      5. Lastly, I run a flow to create the email

        SendDeliveryEmail.Run(txtEmail1.Text,txtEmail2.Text,txtAddEmail1.Text,txtAddEmail2.Text,HtmlText1.HtmlText,varSigAttachment,varPhotoAttachment);

        In the example above, several emails are the first four arguments, then the HTML text, and then some attachments.

      I hope this gives you a foundation upon which you can build something in HTML for your specific needs

      ——————————
      Larry Heimendinger
      larry@techevents.com
      EverettWA
      ——————————
      ——————————————-

    • Harold Kless

      Member

      December 29, 2021 at 12:05 PM

      I tested your expression, and the Outlook window is displayed.
      I’m just using the default text for the HTML Text control.Ā Ā 
      The body of the message shows the html tags.Ā 

      If you are submitting the body of the message, why not use the Office365 Outlook connection to just send and email without launching Outlook.
      Harold

      ——————————
      Harold Kless
      TX
      ——————————
      ——————————————-

    • Fabian Heil

      Member

      January 3, 2022 at 5:40 AM

      I think, it is because ” and ‘.
      In the normal HTML, it uses “, but to work in the html, i have to replace it with single quote `.
      Is there a formula to replace all ` with “?

      Substitute will not work, because it uses “” to define the replacement text

      ——————————
      Fabian Heil
      ——————————
      ——————————————-

    • Warren Belz

      Member

      January 3, 2022 at 5:43 PM

      HTML accepts either, but Power Apps interprets “” as a Text delimiter. If you want to try the Substitute

      Substitute(HtmlText2_1,"'","""")?

      ——————————
      Warren Belz
      Queensland Australia
      ——————————
      ——————————————-

    • Fabian Heil

      Member

      January 10, 2022 at 7:43 AM

      Thank you for your input! I still didnt get it to work yet.
      To explain my scenario: The user who opens the new email wants to add some manual data, therefore i use a mailto link instead of sending the email directly.

      Changing the double quotes to single quotes didnt help. i created an easy example but that also doesnt work.


      This is how the html looks like. As soon as i remove the “concat” row, it works.

      ——————————
      Fabian Heil
      ——————————
      ——————————————-

    • Warren Belz

      Member

      January 10, 2022 at 4:51 PM

      ,
      Try the original without EncodeURL – I have never uses it and simply sent the HTML Text?

      ——————————
      Warren Belz
      Queensland Australia
      ——————————
      ——————————————-

    • Tom Woodhill

      Member

      January 11, 2022 at 2:46 AM

      Hi Fabian,

      I’ve been watching this thread with interest as I have a similar problem: I want to set up an HTML body and give the user the flexibilty of using a mail program (outlook) to fill in the To, CC and BCC fields (much more elegant / faster than writing the interface in powerapps myself).

      Alas, it is impossible.

      The trouble is the mailto RFCs specify plain text. Outlook actually does the right thing and is not designed to accept HTML in a mailto link. Which is all a bit disappointing.

      šŸ™

      The only option is to write an email interface yourself – unless there is library with one, that i don’t know about. (am scouring github now)

      ——————————
      Tom Woodhill
      Principal Governance Officer
      Brisbane
      ——————————
      ——————————————-

    DSC Communities replied 3 years, 8 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘PowerApps Button – MailTo Link with big html body’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!