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.
Solved! Go to Solution.
@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
}
)
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.
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
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
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.
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!
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.
Correct , After attach image, you can use attached IMG file in HTML as an element
@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
}
)
User | Count |
---|---|
149 | |
94 | |
85 | |
78 | |
57 |
User | Count |
---|---|
193 | |
175 | |
104 | |
95 | |
91 |