Home >Tips >SharePoint Flows >Flow to send e-mails from a shared mailbox kalmstrom.com site map icon Site map  

Flow that Sends E-mails from a Shared Mailbox

A SharePoint Flows tutorial by Peter Kalmström

Flow iconFlows can send out different kinds of e-mails. In SharePoint flows, the change alert e-mails are the most common, and we have already shown such flows in earlier articles.

Here we will instead describe how a flow can be used to pick data from a SharePoint e-mail list and send e-mails from a shared mailbox. When users enter data in the SharePoint list, the e-mails are sent automatically.

Benefits

Using a SharePoint list and a flow in this way gives better control than letting each user send e-mails from the shared mailbox. The data of the outgoing e-mails is gathered in a SharePoint list, where it can be sorted, filtered, searched and displayed in different views – something that is more difficult to do in a shared mailbox.

Another advantage is that you don't have to give a lot of people access to the shared mailbox. They only need permission to create items in the list.

The demo

In the demo below Peter Kalmström, CEO and Systems Designer of kalmstrom.com Business Solutions, shows how to create a flow that picks information from a SharePoint list and adds it to an e-mail that is sent from a shared mailbox.

Peter even shows how to include attachments in the flow generated e-mails. This is of course important when the e-mails are sent to people who cannot share files in a SharePoint library, for example to customers or suppliers outside the organization.

Including attachments in the flow generated e-mails is however a bit complicated. In his research on how to best get the flow to allow attachments, Peter found inspiration in a blog post by Django Lohn. The flow can of course be used without the attachments part, and then it is much easier to create.

The SharePoint list

Before Peter starts with the flow, he creates a SharePoint list for the e-mail data with columns for receiver, subject, attachments and body.

Create a flow that picks data in new list items and sends e-mails from a shared mailbox

Use the shared mailbox account when you create the flow. Peter gives each flow step a suitable name to make it easier for colleagues to follow and change the flow if needed.
  1. Start creating the flow from inside the list or by going to https://flow.microsoft.com. Use the trigger 'SharePoint - when an item is created'.
  2. Select or write in the list for e-mail sending you created and the site where it is situated.
  3. Add an action to contain the attachments: 'Variable: initialize variable'. Give it a name and select the type 'Array'.
  4. Add an action to get the attachments from the list item: 'SharePoint - Get attachments'. Select the same site and list as in point 2 and the dynamic content 'ID'.
  5. Add a loop through the attachments by selecting 'Add an apply to each'. Use the dynamic content 'Body' as output.
  6. Add an action that gets the content from the attachments: SharePoint - Get attachment content'. Select the same parameters as in step 4 plus the dynamic File identifier 'Id'.
  7. Add the attachment content action to the array using 'Variable - Append to array variable'. Enter the name 'Attachments' and build a JSON object for the value:

  8. Outside the loop, add an action: 'Office 365 Outlook - send an e-mail' and add the dynamic content for the fields To, Subject and Body. Under advanced options, specify HTML and set the importance to Normal. At Attachments, add the dynamic content variable 'Attachments'.
  9. Save and test the flow.





Learn more



---------------------------------------------------------------------------------------







Always the latest news in the kalmstrom.com blog



Follow kalmstrom.com on LinkedIn Facebook, Google+  or Twitter!

back icon next icon