Friday, February 24, 2023

Power Automate REST API sends an email

 Here, we will see how to send an email via outlook using Power Automate REST API. Also, it allows you to send emails to multiple users. To implement this, let us create a flow and the following steps are:

  • On Power Automate, create an instant cloud flow that will trigger manually.
  • Under the trigger, add a ‘Send an HTTP request to SharePoint‘. Then provide the SharePoint site address and set the properties such as:
    • Method – POST
    • Uri- _api/SP.Utilities.Utility.SendEmail
    • Headers-
      • accept – application/json;odata=verbose
      • content-type – application/json;odata=verbose
    • Body
{
                "properties": {
                    "__metadata": { "type": "SP.Utilities.EmailProperties" },
                    "From": "sonam@tsinfotechnologies.onmicrosoft.com",
                    "To": { "results": ["user3@tsinfotechnologies.onmicrosoft.com", "user2@tsinfotechnologies.onmicrosoft.com"] },
                    "Subject": "Test email",
                    "Body": "Hey !! It is a sample email for testing purposes!"
                    
                }
}
power automate rest api send email
Power Automate REST API send email

Now, save the flow, test it manually, and run the flow. We can see it will send an email notification to the mentioned user(s) via outlook like below:

power automate outlook rest api
power automate outlook rest API.

similarly, an email has been sent to another user. This is how to send an email using Power Automate REST API.

No comments:

Post a Comment

How to Deploy your API as a web app or API app

  Before you can call your custom API from a logic app workflow, deploy your API as a web app or API app to Azure App Service. To make your ...