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,

2 REPLIES 2
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.