cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Data table as body of email

@WarrenBelz I am creating an app that will gather information about a new hire and what equipment they will need. I am now at the point where I need to take the data and send it as an email. I have already created an HTMLtext document that will house all my gathered data. However, I am having issues collecting the HTMLtext document and sending it to my email. Below will be a copy of my HTMLtext document.

 

Thank You

 

 

 

 

"<table width='100%' border='1' cellpadding='5' style='border:1px solid black; border-collapse:collapse'>" &
    "<tr style='background-color:#efefef'>
        <th>StartDate</th>
	<th>FirstName</th>
        <th>LastName</th>
        <th>Community</th>
	<th>Position</th>
	<th>Supervisor</th>
	<th>Microsoft</th>
	<th>DropBox</th>
	<th>Concur</th>
	<th>Upkeep</th>
	<th>Eldermark</th>
	<th>EMAR</th>
	<th>SM</th>
	<th>MM</th>
	<th>Phone</th>
	<th>Laptop</th>
	
    </tr>" &
    Concat(Data,
    "<tr>
        <td>" & Date & " </td>
        <td>" & FirstName & " </td>
        <td>" & LastName & " </td>
	<td>" & Community & " </td>
	<td>" & Position & " </td>
	<td>" & Supervisor & " </td>
	<td>" & Microsoft & " </td>
	<td>" & DropBox & " </td>
	<td>" & Concur & " </td>	
	<td>" & Upkeep & " </td>
	<td>" & Eldermark & " </td>
	<td>" & EMAR & " </td>
	<td>" & SM & " </td>
	<td>" & MM & " </td>
	<td>" & Phone & " </td>
	<td>" & Laptop & " </td>
    </tr>") &
    "</table>"

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Frequent Visitor

Awesome, now it sends the table I need. I will put a copy of the code up for anyone trying to send a table in the future. This will work as long as you set up the connector under Outlook.com and verify it with an email address. Thank you vert much @TJO and @v-yutliu-msft  for all your help I will now mark this issue as fixed.

 

'Outlook.com'.SendEmail ( "Name@ANYEMAIL.COM", "ANY TITLE" ,  "<span>" & HTLMDOCUMENT.HtmlText & "<span>", {IsHtml: true})

 

 

View solution in original post

13 REPLIES 13
Resolver II
Resolver II

@Durell_T You need to set up the Office Outlook connection and mail function. In this sample code the html text is inside a HTML text control (Insert > Text > HTML text)

Office365Outlook.SendEmail(
   User().Email,
   "Mail Title",
   "<span>" & htmlReport.HtmlText & "</span>",
   {
    Cc: varMailCc,
    IsHtml: true
   }
)

 

Frequent Visitor

Unfortunately, my company has only purchased MS Office apps at this time, and that does not include Outlook. This probably will call for me to hard code the email sending process.

@Durell_T Wicked, so the connectors are not available to you?

Frequent Visitor

@TJO the only Outlook connector I can configure is Outlook.com do you think that will work?

 @Durell_T I don't know, I've got 3 Office Connectors in my app: 

- Office365Users         //I guess that's for looking up user data like mail, full name

- Office365                 //no idea lol 🙂

- Office365Outlook    //This one is for the mail sending

 

But I can't tell right now what's the Office365 good for

@Durell_T You can get an idea of what's feasible for you by setting up the connection and then hoping for intellisense to show the options available...

'Outlook...

 

Frequent Visitor

@TJO I went ahead and set up the Outlook.com connection and it allowed me to put my personal outlook email in it. The other options I have are the following:

  1. Outlook customer Manager (preview)
  2. Office 365 Outlook-requires Outlook email connected to credentials
  3. Outlook.com-seems to take any Outlook email (free)
  4. Outlook Tasks

However, I don't know to properly use the connectors to take my Data Table and put it in the body of the email. Below will be my pseudo-code to try and collect my Data Table and my pseudo-code for sending the email.

Collect Data Table Code
ClearCollect(
   Data,             // or HtmlText1
   ShowColumns(
      "Date",
      "FirstName",
      "LastName",
      "Community",
      "Position",
      "Supervisor",
      "Microsoft",
      "DropBox",
      "Concur",
      "Upkeep",
      "Eldermark",
      "EMAR",
      "SM",
      "MM",
      "Phone",
      "Laptop",
   )
)

Send Email Code
   Office365Outlook.SendEmail(
   User().Email,
   "New Hire Form",
   "<span>" & htmlReport.HtmlText & "</span>",
   {
    Cc: varMailCc,
    IsHtml: true
   }
)

 

Hi @Durell_T ,

Do you want to send an email with a collection data?
Actually, the formulas that you provided are right. Maybe you are still a little confused about the steps.

Now let me describe more clearly about this:

1)connect with office365 outlook

98.PNG

 

2)create a collection with the data that you want

set the app's OnStart:

ClearCollect(
   Data,             // or HtmlText1
   ShowColumns(
      "Date",
      "FirstName",
      "LastName",
      "Community",
      "Position",
      "Supervisor",
      "Microsoft",
      "DropBox",
      "Concur",
      "Upkeep",
      "Eldermark",
      "EMAR",
      "SM",
      "MM",
      "Phone",
      "Laptop",
   )
)

3)insert a html text control to display the data table that you want to send in email

set the html text's HtmlText:

"<table width='100%' border='1' cellpadding='5' style='border:1px solid black; border-collapse:collapse'>" &
    "<tr style='background-color:#efefef'>
        <th>StartDate</th>
	<th>FirstName</th>
        <th>LastName</th>
        <th>Community</th>
	<th>Position</th>
	<th>Supervisor</th>
	<th>Microsoft</th>
	<th>DropBox</th>
	<th>Concur</th>
	<th>Upkeep</th>
	<th>Eldermark</th>
	<th>EMAR</th>
	<th>SM</th>
	<th>MM</th>
	<th>Phone</th>
	<th>Laptop</th>
	
    </tr>" &
    Concat(Data,
    "<tr>
        <td>" & Date & " </td>
        <td>" & FirstName & " </td>
        <td>" & LastName & " </td>
	<td>" & Community & " </td>
	<td>" & Position & " </td>
	<td>" & Supervisor & " </td>
	<td>" & Microsoft & " </td>
	<td>" & DropBox & " </td>
	<td>" & Concur & " </td>	
	<td>" & Upkeep & " </td>
	<td>" & Eldermark & " </td>
	<td>" & EMAR & " </td>
	<td>" & SM & " </td>
	<td>" & MM & " </td>
	<td>" & Phone & " </td>
	<td>" & Laptop & " </td>
    </tr>") &
    "</table>"

4)use a button to send the email

set the button's OnSelect:

 Office365Outlook.SendEmail(
   User().Email,
   "New Hire Form",
   "<span>" & htmlReport.HtmlText & "</span>",
   {
    Cc: varMailCc,
    IsHtml: true
   }
)

 

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-email-a-collection-as-attachments/td-...

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msftSo far I can now send my data to my email but it comes as the code in the HTML box and not the table itself. I skipped the collection process and made the button to send the email so this may be why I have this issue.  Below is a picture of what I see in my email and ill also have my new code for my button.

Send button code
'Outlook.com'.SendEmail ( "GrandITSUPP@outlook.com", "New Hire Form" ,  "<span>" & HtmlText1.HtmlText & "<span>")

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (92,687)