Send Email with Graph
Introduction
The Send Email with Graph connector leverages Microsoft Graph to enable seamless email sending capabilities within Power Automate. This connector allows you to send emails from Power Automate without the need to create a User Account from your Microsoft 365 organization, ensuring secure and efficient communication.
It supports HTML text formatting, attachments, To, CC, BCC, making it a versatile tool for sending emails from Power Automate.
For a full guide on how to install it, check out the blog post here.
Prerequisites
To use this connector, you will need:
- Access to Microsoft 365.
- Permissions to create an app registration in Entra.
- A Power Automate environment.
Obtaining Credentials
To use this connector, you will need to create an application registration.
Step 1 - Log in to Entra
- Go to https://entra.microsoft.com and log in with your user account.
Step 2 - Create the app registration
- On the Entra Overview page, open Identity.
- Navigate to Applications in the left-hand menu and open App Registrations.
- Select New Registration.
- Provide a name for your app registration and click Next.
Step 3 - Add API permission
- In the left-hand menu, click on API Permission.
- Click on Add permission.
- Select Application Permission.
- Search for mail.send, open the Mail option, and select mail.send.
Note: This permission allows sending emails as anyone. Restrict access appropriately.
Step 4 - Grant Admin Consent
- Ask a Global Administrator to grant admin consent for the app registration.
Supported Operations
The connector supports the following operations:
- Sending emails with HTML formatting.
- Adding attachments to emails.
- Using To, CC, and BCC fields.
Parameters
Below are the parameters required for the connector:
- user-email: The email address of the sender.
- message.subject: The subject of the email.
- message.body.contentType: The content type (e.g., HTML).
- message.body.content: The body of the email.
- saveToSentItems: Boolean to save the email in Sent Items.
- emailAddress.address: The recipient’s email address.
Using the Connector
Step 1 - Find custom connectors
- Navigate to
https://make.powerautomate.com/
. - Change your environment if needed.
- In the left-hand menu, navigate to More > Discover all > Custom connectors.
Step 2 - Create a new connector
- Click on New custom connector.
- Select Import an OpenAPI from URL.
- Enter the connector name
Send email using Graph
. - Provide the URL:
https://raw.githubusercontent.com/itweedie/PowerPlatform-Send-Emails-from-Power-Automate-without-a-Service-Account/refs/heads/main/connector/shared_mightora-5fsend-20mail-20with-20graph-5fe07b0f04a8b0d4c3/apiDefinition.swagger.json
.
Step 3 - Configure your connector
- Go to the Security tab.
- Set OAuth 2.0 as the authentication type.
- Set the Identity Provider to Azure Active Directory and enable Service Principle support.
- Enter the Client ID and Secret Value from your app registration.
Step 4 - Add C# to process attachments (Optional)
If you need to send attachments, add the provided C# code to the connector’s code section.
Try it Out
Step 1 - Add your first connection
- Go to the Test tab.
- Click on New connection.
- Enter your Secret, Client ID, and Tenant ID.
- Click Create Connection.
Step 2 - Test the connector
- Scroll to Operations.
- Fill in the required parameters.
- Click Test operation and verify the response.
Known Issues and Limitations
- Requires Global Admin consent for API permissions.
- Limited to the permissions granted during app registration.
License
This project is distributed under the MIT License. See the LICENSE file for more details.
Contributions
Contributions are welcome! Please submit issues or pull requests via the GitHub repository.
Git Repository Contents
- Swagger Definition: API definition for the connector.
- Source Code: C# code for processing attachments.
- Documentation: Instructions for using the connector.
- Tests: Example test cases.
Additional Notes
- Avoid repetitive content.
- Ensure the document flows logically and is easy to follow.
- Use consistent formatting for headings, lists, and code snippets.