Power Apps Email Automation: Send Outlook Messages with Precision
A practical guide to building email capabilities in your canvas apps using the Office 365 Outlook connector, covering recipients, formatting, attachments, and more.
Imagine you've built a helpdesk ticket app in Power Apps. When an agent resolves a ticket, you want to automatically notify the requester with the resolution summary, attach supporting files, and maybe even include a satisfaction survey link. The Office 365 Outlook connector turns that vision into reality. In this guide, you'll learn how to send emails from your canvas app—starting with the basics and then layering on features like a people picker, CC/BCC, attachments, rich HTML formatting, and embedded images.
Everything you see here is built around a fictitious "Ticket Resolution" scenario, but the patterns apply to any app that needs to fire off a message.
1. Getting Started: The Minimum Viable Email
Add the Office 365 Outlook connector to your app (under Data → Add data). Then place these controls on a screen:
txtRecipient– Text input for the email address (or addresses separated by semicolons).txtSubject– Text input for the subject line.txtBody– Text input for the plain-text body.btnSend– Button to trigger the send.
Set the button's OnSelect to:
Office365Outlook.SendEmailV2( txtRecipient.Text, txtSubject.Text, txtBody.Text );
That’s the simplest way. But real apps usually need more flexibility—let's upgrade step by step.
2. Using a People Picker for Internal Recipients
If you're sending to coworkers inside your organization, typing email addresses is error‑prone. Use a combo box connected to the Office 365 Users connector.
- Add the Office365Users connector.
- Insert a combo box named
cmbTo. - Set
Itemsto:
Office365Users.SearchUserV2({
searchTerm: Self.SearchText,
top: 10,
isSearchTermRequired: false
}).value- Set
DisplayFieldsto["DisplayName"],IsSearchabletotrue, andSearchFieldsto["DisplayName"]. - Enable SelectMultiple so you can pick several people.
The OnSelect of your send button becomes:
Office365Outlook.SendEmailV2( Concat(cmbTo.SelectedItems, Mail & ";"), txtSubject.Text, txtBody.Text );
Concat joins all selected mail addresses with a semicolon, which the Outlook connector understands as multiple recipients.
3. Adding CC and BCC
Sometimes you need to copy a manager or send a blind copy to another team member. Add two more text inputs: txtCc and txtBcc. Then extend the SendEmailV2 call with an optional record:
Office365Outlook.SendEmailV2(
txtRecipient.Text,
txtSubject.Text,
txtBody.Text,
{
Cc: txtCc.Text,
Bcc: txtBcc.Text
}
);If you also use the people picker for To, simply apply Concat for those fields as well.
4. Attaching Files
Attaching a file is a two‑step process: collect the file(s) and then pass them in the Attachments parameter.
Using the Attachments Control
The built‑in Attachments control is normally part of an Edit Form. To use it standalone:
- Insert an Edit Form, connect it to any data source (e.g., a SharePoint list), and delete everything except the Attachments control.
- Rename that control to
attFiles. - Set its
MaxAttachmentsproperty to, say,5.
In the send button, loop through the control’s Attachments property:
Office365Outlook.SendEmailV2(
txtRecipient.Text,
txtSubject.Text,
txtBody.Text,
{
Attachments: ForAll(
attFiles.Attachments,
{
ContentBytes: Value,
Name: Name
}
)
}
);Attaching a Single Image from an Add Picture Control
For a single image, use the Add picture control. Rename its child image control to imgSnapshot.
Set imgSnapshot.CalculateOriginalDimensions to true. Then attach it like this:
Office365Outlook.SendEmailV2(
txtRecipient.Text,
txtSubject.Text,
txtBody.Text,
{
Attachments: {
ContentBytes: imgSnapshot.Image,
Name: "Snapshot.jpg"
}
}
);5. Rich Text Formatting in the Body
Plain text is fine for internal alerts, but for customer‑facing emails you probably want formatting. The Rich Text Editor control (name it rteBody) produces HTML automatically.
Set the send button’s OnSelect to:
Office365Outlook.SendEmailV2( txtRecipient.Text, txtSubject.Text, rteBody.HtmlText );
The editor supports bold, italic, bullet lists, font colours, etc.—all converted to valid HTML that Outlook renders.
6. Embedding Images Directly in the Body
Embedded images appear inline, not as separate attachments. Two approaches:
Via the Rich Text Editor
Users can drag an image file into the Rich Text Editor. The control stores the image as a Base64 data URI inside its HtmlText. You send the same way as above—no extra work.
Via the Add Picture Control
If you want to programmatically embed an image without requiring the user to use the editor, use the Add Picture control again. Build an `` tag with a Base64 data source.
With(
{
imgData: JSON(imgSnapshot.Image, JSONFormat.IncludeBinaryData)
},
Office365Outlook.SendEmailV2(
txtRecipient.Text,
txtSubject.Text,
"<html><body><p>Here is the image:</p></body></html>"
)
);Base64‑encoded images increase the email size significantly. Limit embedded images to small diagrams or logos.
7. Building HTML Tables and Links
Dynamic content like a list of recent ticket updates often looks better as an HTML table. You can generate the HTML string in Power Fx using Concatenate or Concat.
With(
{
htmlTable:
"<table border='1' cellpadding='5'>" &
"<tr><th>Ticket</th><th>Status</th><th>Updated</th></tr>" &
Concat(
Filter(Tickets, Status = "Resolved"),
"<tr><td>" & TicketID & "</td><td>" & Status & "</td><td>" & Text(ModifiedDate, "mm/dd/yyyy") & "</td></tr>"
) &
"</table>"
},
Office365Outlook.SendEmailV2(
txtRecipient.Text,
txtSubject.Text,
"<html><body>" & htmlTable & "</body></html>"
)
);To include clickable links, use standard anchor tags inside the HTML.
8. Performance and Security Considerations
- Delegation –
Office365Users.SearchUserV2doesn’t have delegation warnings for thetopparameter, but the result set is limited. For very large directories, consider using a different search approach. - Attachment limits – The
MaxAttachmentsproperty only restricts the UI; there’s no server‑side limit in the connector, but email providers may cap total size (usually 25 MB for Exchange Online). Warn users about large files. - Sensitive data – The email body and attachments are sent in clear text unless your organisation enforces encryption at the transport layer. Avoid including passwords or personally identifiable information in plain‑text emails.
- Error handling – The
SendEmailV2function returns a record but does not throw traditional errors. You can wrap it in anIfErrorcheck (if you're using Power Fx error handling) to show a notification on failure.
9. Common Pitfalls & Troubleshooting
| Problem | Likely Cause | Fix |
|---|---|---|
| Email not sending; no error. | The Outlook connector may not be added to the app. | Go to Data → Add data and add Office365 Outlook. |
| People picker shows no results. | Search string too short or connector missing. | Set isSearchTermRequired to false and ensure Office365Users is added. |
| Attachments control won’t appear in the insert menu. | It’s only available inside an Edit Form. | Insert an Edit Form, then delete everything except the Attachments control. |
| HTML email shows as plain text. | Missing <html> and <body> tags. | Wrap your HTML content in <html><body>...</body></html>. |
| Embedded image doesn’t display in Outlook. | Outlook blocks inline images by default. | Users may need to enable “Download pictures” in Outlook settings. |
10. Final Recommendation
Start simple: send a test email with only the recipient, subject, and plain body. Once that works, add one feature at a time—CC/BCC, attachments, rich text. The Office 365 Outlook connector is robust and well‑documented, but each addition increases complexity and potential failure points. Always test with a small, safe audience before rolling out to real users.
For a production app, consider adding a confirmation dialog before sending and a way to review the email content (including attachments) in a preview screen. Your users will thank you.
References
- Original article: Power Apps Send Email Using Outlook – The Complete Guide by Matthew Devaney
- Microsoft Learn – Office 365 Outlook connector
- Microsoft Learn – Office 365 Users connector
Learn how small coding practices—like using descriptive names, flattening conditions, and simplifying logic—can make your apps easier to update and less error-prone.
Move past the gallery and discover the hidden patterns for validation, navigation, and smart submission handling in your data entry forms.
PowerShell unlocks admin capabilities that the Power Platform admin center simply doesn’t offer—from recovering deleted apps to blocking trial licenses. Here’s how to wield them safely.