cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KW001
Level: Powered On

How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

Thanks in advance to anyone who can provide insight! 🙂

 

Building a powerapp that walks a user through a series of screens to collect responses. Those responses then get compiled into an HTML input box for the purpose of then using the HTML input box as the body of an email sent via Office365.SendEmail. 

 

The problem I am trying to solve is this:

I need to add a logo image inline within the HTML so that the image displays inline in the sent email. Within the company O365 / exchange environment a simple <img src.... tag does not display the image itself in the email. Regardless of the URL being internally / internal publicly accessible or externally hosted.

 

Details:

Final button function is:

Office365.SendEmail(Office365Users.MyProfile().Mail & ";" , var_EmailSubject,(HtmlText_EmailBody.HtmlText),{Importance: Normal, Cc: var_EmailCC1 & var_EmailCC2,IsHtml: true})

 

Example of body content:

<table>

<tr>

    <th><!-- logo image --></tr>

    <th>text</td>

</tr>

<tr>

    <td>text</td>

    <td>gathered text</td>

</tr>

</table>

 

19 REPLIES 19
Power Apps Staff Mr-Dang-MSFT
Power Apps Staff

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

@KW001, it sounds like you want to send an email with HTML content.

 

I know the perfect expert who has tinkered with scenarios like this-- @KickingApps! She has experience with different methods and caveats that can be very helpful.

KW001
Level: Powered On

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

Thanks for the reply @Mr-Dang-MSFT !

 

That's what I am trying to do:) However I need the image to be embedded in the email rather than just an HTML <img> tag that points to a web resource. MS Outlook does not want to render the image when it's done as an <img> even if the source is within the intranet and publicly available on a website, sharepoint, etc. There isn't even a "load this content" option for items like this. 

 

I looked at the send email code for attachments, but how do you get the attached image inline? It's not useful in this scenario to simply attach the image to the email. Presentation is the focus.

 

Is there a different email function? Trying to avoid also implementing MS FLOW just for this single inline logo image...

KickingApps
Level 8

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

@Mr-Dang-MSFT - Thanks for the mention. 

@KW001 - Sorry I am just replying; I haven't checked community in awhile. I will take a look at this as soon as I can get some time. (Promising to prioritize).

KickingApps
Level 8

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

@KW001 In the below, I refer to links in my HTML text and the image is the email body. Is this what you have in mind?email.jpg

KW001
Level: Powered On

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

@KickingApps thanks for taking the time to help me with this!!

 

Yeah the end goal is to have inline displayed images in the email much like you have displayed. The problem I am running into is that within the corporate O365 environment when I use a powerapp to build the HTML code (html table in this case) that inclues an image in one of the table cells, the image does not display in the email when it's an <img src=....> html tag. I get the image not loading icon in the received email. 

 

2019-10-24 07-49-55_Cortana.png

 

I don't want to use the (example, not my code)

{Attachments:Table({Name:"file1.jpg", ContentBytes:Camera1.Photo, '@odata.type':""})}

Since that just attaches it to the email in Outlook, rather than displaying it inline. 

 

The <img src> tag URL being used is an image on the corporate Intranet, and universally available within the company intranet. 

 

All that being said the PowerApp I have built includes said Image as part of the PowerApp UI. So the image is part of the media / collection of the PowerApp as well. I just don't know how to embed the image inline when using the 

Office365.SendEmail(Office365Users.MyProfile().Mail & ";" , var_EmailSubject,(HtmlText_EmailBody.HtmlText),{Importance: Normal, Cc: var_EmailCC1 & var_EmailCC2,IsHtml: true})

 

(Note: The PowerApp gathers information and stores them in a number of variables using the previous screens selections made by the user. It then builds an HTML output which is the "HtmlText_EmailBody.HtmlText" above. And that is then used as the email body being sent via the "Office365.SendEmail..." function. 

 

Hope this clarifies better! Any and all help would be appreciated! If I have to drastically change the workflow or path to generating the email contents that is totally fine! Anything to get the desired output is great!

KickingApps
Level 8

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

@KW001 - Add you photos to a collection in your app. Then put this in you your html code:
"<table>
<tr>
<td valign='Top'>
<img src=" & Image & " style=""width:300px;height:250px;"">
</td>

</tr>
</table>"

 

For me, Image is the name of the column in my collection where the actual image is stored. Let me know how it goes. I

KW001
Level: Powered On

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

@KickingApps To my shame I am struggling with the call to the collection as you noted.

 

The app has the logo image on all the screens as a media asset. I then try to load that logo into a collection (I have tried to pull that image from screens to add to the HTML and that fails to be part of the email as well). I notice in the collection the picture is not under the image column, but rather the URL column. 

 

All that being said I am working on the HTML code and struggling with the syntax. The wizard auto fill text is not helping either in this case.

 

"<tr>
	<th>
		<img src=""" & Collection1[what goes with this?] & """ style=""width: 200px; height: 200px;"" />
	</th>
	<th>
		<img src=""" & 'Logo' & """ style=""width: 200px; height: 200px;"" />
	</th>
</tr>"

It amazes me that it's this hard to include native media from the app into the HTML email! arrgh!!! 

 

Any and all help is MUCH appreciated!

 

KickingApps
Level 8

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

First, let me begin by apologizing. I realized I left a few things out in my haste to get you a reply.  That said, I hope this helps you acheive your goal. If you have questions, reach out and I will help you work through it.

Thanks.

Highlighted
KW001
Level: Powered On

Re: How To: Powerapp builds HTML to Office365.SendEmail w/ Inline image

@KickingApps 

Reviewing! Keep you posted!

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,894)