Wednesday, November 14, 2018

Sending e-mails in Microsoft Flow using SharePoint

Introduction

image

A lot of Flow scenarios involve sending alert or information e-mails to someone in your organization.These are typically e-mail which don’t require a response. Something happened, and you want to notify someone. And this is what this post is all about.

Yeah, yeah, we should cut down on e-mails, but that’s not happening any time soon – so read on!

How

There are multiple posts out on the interwebs letting you know how to send an e-mail using Microsoft Flow. Most of the time in a corporate environment you will be using the Office 365 Outlook connector, which means the e-mail is sent with a From address equal to the user/service user used to set up the Flow.

To sum up, this means that the user/service user must have a mailbox in order to send the e-mail. And if the recipient replies, the reply will go into that mailbox.

image

Another approach, which don’t require a mailbox, is to send the e-mail via SharePoint, where the sender will be no-reply@sharepointonline.com.

All you need is to use the “Send an HTTP request to SharePoint” action, and you can control the sender name (no e-mail address) by using different sites as the sender. Which means the site name will be the sender name – enough context for anyone right?

image
  • Site Address: The site you want to send the e-mail from, root site or any other site as long as the user/service user have access to it.
  • Method: POST
  • Uri: _api/SP.Utilities.Utility.SendEmail
  • Headers
    • accept: application/json;odata=nometadata
    • content-type: application/json;odata=nometadata
  • Body:
  • {
        'properties': {
            'To': ['someone@puzzlepart.com','another@puzzlepart.com'],
            'Body': '<b>Yo</b><br/>O boy!',
            'Subject': 'E-mail using Flow via SharePoint'
        }
    }
And that’s all there is to it. Keep sending them e-mails!

Note

This only works for sending e-mails to people in your tenant, not outside.