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

Send email with attachments

Hi Peers,

Hope you all are doing well.

 

Requirement: send email with attachmets such as image. getting error "office365.SendEmail failed: The method "sendEmail" has invalid value for parameter body". I might have given wrong expression

Below is the expression which has been used in button - OnSelect

Office365.SendEmail(
   "krg@cgl.com",
    "Task Completion Notification on "  ,
    HtmlText1.HtmlText,
    {
        IsHtml: true, Cc: "krg2@cgl.com",
        Attachments: Table(
            {
                Name: "TEST.jpg",
                ContentBytes: PenInput1.Image,
                '@odata.type': ""
            }
        )
    }
)
FYI, Below expression is working without issue 
Office365.SendEmail(
          "krg@cgl.com"
            "Task Completion Notification on ",                    
           "<b><font color=blue>HTML</font></b>text")

 

 

Many thanks,

4 REPLIES 4
Community Support Team
Community Support Team

Re: Send email with attachments

Hi @krishnapwa,


According to your description, I have made an app likes below, which is used to send an email with an attachment.
First, create a connection to Office 365 Outlook. Then add a button, two text input controls for To and Subject, and a HTML text control for Body, and a Pen input control for the image attachment.
Then set OnSelect property of the button with the following code:

Office365.SendEmail(
     TextInput1.Text,
     TextInput2.Text,
    HtmlText1.HtmlText,
      {
        IsHtml:true,Cc:"mabel@xxxxx.onmicrosoft.com",
        Attachments:Table(
         {
           Name:"human2.jpg",
           ContentBytes: PenInput1.Image,
           '@odata':""
          }
       )
    }
)

Please check it for a reference and try again with it on your side.

2.PNG3.PNG
By the way, please check the instructions in the following doc for more details:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/connections/connection-office365-outloo...

 

Best regards,
Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
krishnapwa
Level: Powered On

Re: Send email with attachments

Thank you so much Team for reply,

let me go through it and revert back.

krishnapwa
Level: Powered On

Re: Send email with attachments

Hi Team,

 

It helped me lot. 

Could you please suggest on below please

1.  How to reset this pen input . this image is not getting reset after sending email. Still showing old one after going to next record

2. Can we do with camera contorl the same. ex: take photo from camera and send email this attachment.

Please assist on above, also share any links/urls , highly appreciate

MFern
Level: Powered On

Re: Send email with attachments

I can help out with 2.

 

I used the media "Add Picture".

 

On its on select property of the AddMediaButton1, I have it set to:

UpdateContext({counter: counter+1}); Collect(CameraPics,({Name:"pic" & counter & ".jpg", ContentBytes:UploadedImage1.Image, '@odata.type':""}))

 

I also have a gallery of the images with the items set to: CameraPics

My onsuccess of the form looks like this:

Office365.SendEmail.V2(To,Subject,Body, {Attachments:CameraPics});Clear(CameraPics);Navigate(DetailForm1,Fade)


However I am still trying to figure out how to make this work with my sharepoint attachments as this isnt saving my pictures anywhere to my form.

 

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 36 members 4,011 guests
Please welcome our newest community members: