Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Email Attachment

(0) ShareShare
ReportReport
Posted on by 583

All,

 

I have tried this a couple ways and I'm not having any luck. I have a NewForm to add to a datasource in a SharePoint list with attachments. I also need to be able to send this data as an email without using a flow and without using the Outlook connector. So what I need is when the form submit button is pressed I also need it to do the following, Mail.SendEmailV3("emailaddress","subject",HtmlText1.HtmlText,true,{filenames:attachmentname,files:attachment}) but I can't get the attachment part to work.

 

Any help is greatly appreciated.

  • StephenGW Profile Picture
    StephenGW 583 on at
    Re: Email Attachment

    @timl and @Ramole 

     

    When I put this in my form(Form2) it gives me an error.

     

    Mail.SendEmailV3("email@email.com",
    DataCardValue21.Text,
    HtmlText1.HtmlText,
    true,
    {
    files:First(Form2.LastSubmit.Attachments).Value,
    filenames:First(Form2.LastSubmit.Attachments).DisplayName
    }
    )

     

    Both the Files and Filenames have errors, the filenames says its expecting text but using an Error type. Same for the files, expecting Blob and using Error type.

     

    The attachment data card uses an IF to make it required based on another data card if that might be causing it.

     

    Any ideas on this?

  • timl Profile Picture
    timl 33,615 on at
    Re: Email Attachment

    Hi @StephenGW 

    You might be interested in my blog post here, which describes the syntax that @Ramole mentions and explains how to use the Mail connector in more detail.

    http://powerappsguide.com/blog/post/when-and-how-to-use-mail-connector

    In your case, since you want to send your message on the submission of a new record, you would add the following formula to the OnSuccess property of your form. LastSubmit.Attachments provides access to the attachments.

    Mail.SendEmailV3("tim@emailaddress.com", 
     "New record - Files", 
     HtmlText1.HtmlText,
     true,
     {
     files:First(Form1.LastSubmit.Attachments).Value,
     filenames:First(Form1.LastSubmit.Attachments).DisplayName
     }
    )

     

  • Ramole Profile Picture
    Ramole on at
    Re: Email Attachment

    Hi @StephenGW 

     

    Sorry I never used Mail connector but try this please 

     

    Mail.SendEmailV3("Name@microsoft.com", 
     "Enter the email title here", 
     "Enter your email message here",
     false,
     {
     files:First(ThisItem.Attachments).Value,
     filenames:First(ThisItem.Attachments).DisplayName
     }
    )

     

     

  • StephenGW Profile Picture
    StephenGW 583 on at
    Re: Email Attachment

    @Ramole 

     

    I could not get this to work with the Mail connector as I stated I cannot use the Outlook connector. Do you know how to do this with the Mail connector?

  • StephenGW Profile Picture
    StephenGW 583 on at
    Re: Email Attachment

    @Powerplatform01 

     

    As mentioned in my post I would like to avoid using Flow. I need the email to be fully translatable into other languages and the best way I found to do that is to build the email in HTML in the app. Also I need every entry in the app form to go to the SharePoint list but only some conditions will send an email.

  • Ramole Profile Picture
    Ramole on at
    Re: Email Attachment

    Hi @StephenGW 

    Let's suppose we take a SharePoint record with file attachments. If we add a card to a detail form, the syntax to add the file attachments to an email message looks like this:
     
    Office365Outlook.SendEmailV2(
    "Name@emicrosoft.com",
    "Email Subject",
    "Email Body",
    {
    Attachments: RenameColumns(
    ThisItem.Attachments,
    "Value",
    "ContentBytes",
    "DisplayName",
    "Name"
    ),
    Importance: "Normal"
    }
    )
  • Powerplatform01 Profile Picture
    Powerplatform01 386 on at
    Re: Email Attachment

    You can watch this video to resolve your issue

    https://youtu.be/GA_f5GX5H-Q

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,304

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard