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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Apps
Answered

Image in Email

(0) ShareShare
ReportReport
Posted on by 583

Hello all,

 

I have created an app for entering data into OneDrive and Excel. The app works good. I also have added an email which is so close to working but I need to add an image in the HTML Body of the email. I have to rely on the Mail connector (no attachment choice) because I cannot use Outlook due to the exchange server error and cannot migrate. Here is what I have so far. I use the AddMediaWithImage to get the picture. For the AddMediaButton I have this to collect and then I think convert to 64bit OnSelect.

 

ClearCollect(ClickedPhoto,{Name:"Picture",ContentBytes:UploadedImage1.Image, '@odata,type':""});Set(ClickedPhotoVar,JSON(ClickedPhoto,JSONFormat.IncludeBinaryData ));Set(ClickedPhoto64,Mid(ClickedPhotoVar,24,Len(ClickedPhotoVar)-24))

 

I then add it into the HTML like this.

 

"<p><font size='6' color='red'><b>**** Do Not Reply To This Email ****</b></font><br><br><font size='3' color='black'><b>Please review findings</b></font><br><font size='6' color='black'><b>"&ddDepartment.Selected.Result&" Audit Findings</b></font><br><br><font size='3' color='black'><b>Auditor: </b>"&ddAuditor.Selected.Auditor&"</font><br><br><font size='3' color='black'><b>Area: </b>"&ddArea.Selected.Result&"</font><br><br><font size='3' color='red'><b>Pass/Fail: </b>"&ddPass.Selected.'Pass/Fail'&"</font><br><br><font size='3' color='black'><b>Issue Found: </b>"&tiIssue.Text&"</font><br><br><font size='3' color='black'><b>Person Notified: </b>"&ddNotify.Selected.Result&"</font><br><br><font size='3' color='black'><b>Picture: </b></font>,img src=ClickedPhoto64><br><br><font size='3' color='black'><b>Additonal Findings: </b>"&tiAdditonal.Text&"</Font><br><br><font size='3' color='black'><b>Safety Findings: </b>"&tiSafety.Text&"</Font></p>"

 

But this remains a broken image in the email. Anybody have any ideas on how I can make this work? I really need the image with the email.

Categories:
I have the same question (0)
  • timl Profile Picture
    36,415 Super User 2025 Season 2 on at

    @StephenGW 

    Perhaps someone has a better suggestion, but I think you would need to save the images to an Internet accessible location and to reference the URL in your email.

    There is an issue in that the majority of email clients don't show inline, base64 encoded images.

    https://stackoverflow.com/questions/16242489/send-a-base64-image-in-html-email

    That's the likely reason why you see a broken image in your email, and the reason why this type of requirement is challenging.

  • StephenGW Profile Picture
    583 on at

    @timl 

     

    At the end of my app I use this to send it to the Excel sheet which also adds the image to a folder in OneDrive and then it send the email right after, then exits the app. Would there be anyway to grab the link created in the folder in OneDrive after the patch but then include it in the email portion?

     

    Patch(Data,Defaults(Data),{Date:DatePicker1.SelectedDate,Location:ddLocation.Selected.'Locations (Locations)',Auditor:ddAuditor.Selected.Auditor,Department:ddDepartment.Selected.Result,Area:ddArea.Selected.Result,'Pass/Fail':ddPass.Selected.'Pass/Fail','Issues Found':tiIssue.Text,'Person Notified':ddNotify.Selected.Result,Picture:UploadedImage1.Image,'Additonal Findings':tiAdditonal.Text,'Safety Findings':tiSafety.Text});Mail.SendEmailV3(ddTo.Selected.'Emails (Emails)',tiSubject.Text,HTMLBody.HtmlText,true)

     

    Thanks,

    Stephen

  • mequan Profile Picture
    on at

    Hello,

    Actually Outlook will not show Image if it doesn't  think IMAGE file is safe. So if you want to show image in mail, you need to add image file as Email attachment and let email show it.

     

    Thanks

  • timl Profile Picture
    36,415 Super User 2025 Season 2 on at

    Hi @StephenGW 

    Unfortunatlely, there's no way that I know of to grab the link to the file in OneDrive following the Patch.

    Attaching images from OneDrive is always problematic due to authentication.

    As @mequan says, the easiest way to include your picture would be to add it as an attachment, although the disadvantage of this would be that it won't appear in line.

     

     

     

     

  • StephenGW Profile Picture
    583 on at

    @timl 

     

    Thank you. Unfortunately it does not look like the Mail connector allows attachments and I am currently unable to use Outlook connectors due to the exchange server error.

     

    Thank you for all your great help!

  • timl Profile Picture
    36,415 Super User 2025 Season 2 on at

    You're welcome @StephenGW 

    Just for info, the SendEmailV3 method does enable you to pass a single attachment and attachment name as the last argument to the method.

  • mequan Profile Picture
    on at

    Correct , After attach image, you can use attached IMG file in HTML as an element

  • Verified answer
    timl Profile Picture
    36,415 Super User 2025 Season 2 on at

    @StephenGW - For the reference of anyone else reading this, I guess this was the eventual solution to your problem?

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Email-Image-base64/m-p/899101#M285297

     

    Mail.SendEmailV3(ddTo.Selected.'Emails (Emails)'&","&tiAddNote.Text,
     tiSubject.Text,
     HTMLBody.HtmlText,
     true,
     {
     filenames:AddMediaButton1.FileName,
     files:UploadedImage1.Image
     }
    )

     

  • StephenGW Profile Picture
    583 on at

    @timl 

     

    Sorry, I forgot to add a reply here but yes that was the solution I needed.

     

    Thanks,

    Stephen

  • kmw1130 Profile Picture
    988 on at

    @StephenGW I'm not using the HTMLBody (I did try that, but had the same issue having now), but I did follow @Reza Dorrani's video https://www.youtube.com/watch?v=GoF3vfP3YTM&t=129s where I'm just adding the JSON image function in my mail function.  The issue I am having is it is not consistent.  I have 3 buttons that is sending emails, it worked on the first button's email with this in the body of the email:
    <img src="& JSON(Image1.Image, JSONFormat.IncludeBinaryData) & ">

    But the others the image did not show in the emails.  It seems inconsistent, maybe I'm not doing it the best way to ensure the image will always show.  Would using the HTMLBody be more consistent?

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard