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 / Send email with attach...
Power Apps
Answered

Send email with attachment from an AddPicture control (not AddMedia control)

(0) ShareShare
ReportReport
Posted on by 12

Hi Everyone

 

I have an image data card in my PowerApp which is bound to an image field in a SP list.  I am able to upload an image and save it to the SP record.  However, on submission of the PowerApp form, I also want to send an email which references that image control.  Tutorials which explain sending emails with image attachments use the 'UploadedImage' control which is not the same as the Image control.

 

I would appreciate assistance with this issue.

 

Regards

 

Dave

 

PowerApp.png
Categories:
I have the same question (0)
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    You should check out these videos.   I think the first one will answer your specific question, but you may want to watch the second anyway.

     

    https://youtu.be/BUUCATSKNK0

    https://www.youtube.com/watch?v=bIne3DD3HAg

     

  • DudleyDerv Profile Picture
    12 on at

    Hi.  I've watched both these videos and I dont think they answer my question hence reaching out.  To be clear, I can achieve both actions independantly, I just cannot achieve together.  The Image1 control links to the SP list, the Uploadedimage control allows itself to be attached to the email.  Neither appear to do both.  Any ideas?

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    How are you submitting your form, do you have a submit button or are you using the built in Save feature of SharePoint?

  • DudleyDerv Profile Picture
    12 on at

    I use a submit button.

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Are you wanting to embed the image in the email or send it as an attachment?

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    I see where the issue is.  In this video (https://youtu.be/BUUCATSKNK0) where he is referring to UploadedImage1.image, you would use the Image1.Image.  In this first screen shot is my Image Data Card.  You can see the 2 controls, AddPicture1 and Image1.

     

    ImageDataCard.png

     

    In this second image, you can see the Add Picture control in my form and underneath is just an image control referencing that data card.

     

    AddPicture.png

     

    So in your submit button you would do the email part first and then submit the form.  Otherwise it will clear the image and the email part won't work.

     

    To embed the image in your email: 

    Set(varImage, JSON(Image1.Image, IncludeBinaryData));
    Office365Outlook.SendEmailV2("email address", "Subject", "<img src=" & varImage & ">");
    SubmitForm(FormX)
    

     

    To send as attachment:

    Office365Outlook.SendEmailV2("email address", "Subject", "{attachments: (Name: AddPicture1.FileName, ContentBytes: AddPicture1.Media, '@Odata.type':""}));
    SubmitForm(FormX)

     

  • DudleyDerv Profile Picture
    12 on at

    Thank-you again for your assistance!  I now see the issue - the image is cleared when i attempt to email.   My code to send the email is within 'On Success' as i dont want to send the email until the record has been saved.  Is there anyway to achieve that?

  • Verified answer
    JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    This is how I would handle that.   Have a hidden image control (not add picture) outside of the form.   In your submit button set 2 variables.

     

    Set(varImageData, Image1.Image); Set(varFileName, AddPicture1.Filename); SubmitForm(FormX)

    Use the varImageData in the Image property of the hidden image control and use the varFileName in the email if you are sending the image as an attachment.

     

    To embed the image:

    Set(varImageData, JSON(Image2.Image, IncludeBinaryData));
    Office365Outlook.SendEmailV2("email address", "Subject", "<img src=" & varImageData & ">")
    

     

    To send as attachment:

    Office365Outlook.SendEmailV2("email address", "Subject", "{attachments: (Name: varFileName, ContentBytes: Image2.Image, '@Odata.type':""}))
    

     

  • DudleyDerv Profile Picture
    12 on at

    Thank-you for saving my sanity! LOL

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Can't have you losing your sanity now can we?  😎

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard