Sending Emails from SharePoint Solutions Using Microsoft Flow

It’s not at all unusual to want to send an email from some page in SharePoint where there isn’t a native capability available. While there are lots of external services which can send email for us – like SendGrid – we usually want to keep the email “in house” in an enterprise environment. (In fact, there’s even a connector for SendGrid in Flow.)

While using an external service may not be appealing, even Flow is an “external” service. Once you’re in the cloud, you’re in the cloud. However, it seems to make more sense in many cases to simply use Flow to send emails via the Outlook Send an email action.

I’ve started setting up a generic Send an email Flow to support several client projects, so I figured I’d document what I’ve been doing.

The basic idea here is that I want to be able to call a REST endpoint with the details of the email I’d like to send and have it go out to the recipient(s). There’s no validation or tracking here; I just assume it happens. It wouldn’t be all that hard to add another few steps to log the emails to a SharePoint list or something if that were useful for you.

Flow has a perfect trigger for this: When a HTTP request is received. (I would have gone with When an HTTP request is received, personally.)

Start by creating a Flow “from blank”, meaning without using a template. If you search for HTTP, you’ll find the When a HTTP request is received trigger.

This trigger is a great way to create a poor man’s Web Service, just like we need here. Note that the REST endpoint will be provisioned after you save the Flow, so at this point, we don’t know what it will be, but no matter.

I had decided that my payload for the emails was going to be pretty simple, made up only of the To (recipient), Subject, and Body. That’s all it really takes to make a useful email. To set up a sample payload, I decided what I’d like to send in one of my client side SPAs (Single Page Applications) and dummied up some data, like so:

The nice thing here is that Flow will generate the schema it needs from sample data like this. Click on Use sample payload to generate schema and paste in your sample data, like so:When you click Done, you’ll see the schema the trigger needs to “understand” the data you will be sending. If you wanted to make changes to the structure of the incoming data, you could paste in a new sample or edit the schema manually.

Next we simply add a new step to send the email by clicking on New step, then Add an action. I find it by searching for “email”.

Once you’ve chosen that action, you can add the incoming data properties to the properties the Send an email action uses to form the email.

I like to have the option to send HTML emails (all pretty and everything), so I set the Is HTML advanced option to Yes.

It’s also worth noting – mainly because John Liu (@johnnliu) just reminded me after he read this post – that emails go out with Low priority unless you change the setting.

It’s not at all intuitive that this wold be the case, but it may well be how you’d want it set. If not, it’s a simply change in the dropdown in the advanced options.

 

Once you’ve saved the Flow, you can go back into it to get the REST endpoint you need to invoke it.

Finally, you’ll want to call the REST endpoint whenever you want to send an email. Here’s an example function I use in one of my Angular-based SPAs. It’s a pretty generic function, and I simply pass in the to, subject, and body values. Any work I need to do to build up those values happens elsewhere. (Lest you think you can use my Flow, I’ve edited the endpoint inventively. My Flow is still in an undisclosed location.)

And voila! Now you have an easy to use, generic emailing function. One downside to this approach is that the email will be sent using your own connection. For this reason, you may want to set up some fake “users” for the connections in Flow – maybe “SharePoint administrator” or something. I’m hoping the Flow team comes up with a better way for us to manage who the Flow runs as in the future, but for now this works.


Addendum: Eagle-eyed reader Charles Phillips (aka Grumpy Old SharePoint Guy) asked via email why I didn’t just send the email via JavaScript. Call me lame, but to be honest, I wasn’t aware of the method Charles covered in his post How do I send an email in JavaScript?, specifically the /_api/SP.Utilities.Utility.SendEmail method. I guess the other benefit of using Flow is that we can layer in additional generic capabilities as we need them, perhaps logging to a list, informing the sender, etc. without writing any code to do it. I like having a generic call that can do this stuff for me. However, if you’re on premises or can’t use Flow for some reason, the SP.Utilities.Utility.SendEmail endpoint could work well for you.

Advertisements

Office 365 Groups: Let People Outside the Organization Email the Group

As a consultant, on a daily basis I’m working in multiple Office 365 tenants. In some of those tenants I have an account (license) with my own Sympraxis email, and in many others, I have an email address within the client organization’s domain.

Believe me, it all gets pretty confusing – if it weren’t for LastPass keeping track of my logins, I’d be doomed!

With all the Office 365 Groups goodness going on, it’s great to try to keep track of “Group conversations” in a central place. By including the email alias for a Group in email-based exchanges, we can save those conversations for posterity.

Given the complexity of my account setup across clients (let me know if you have suggestions on how to make that easier!), it’s really helpful for me to use my Sympraxis email account to centralize *my* conversation activity, at least.

To do this in a given Office 365 Group, you can change the Let people outside the organization email the group setting for the Group, as shown below. This allows me to be a member of the group with whatever account I have in that tenant, but also to email in with my Sympraxis account.

In theory, this opens up your Group conversation to “spam” or other unwanted outside emails. In practice, it’s probably not a problem, especially for a Group which has a relatively limited lifespan. You’ll probably want to consider which Groups really need this setting enabled.

In any case, it was a little tricky to find the setting after the Group was set up, so I figured I’d share.

  • If you’re in the SharePoint site for the Group, Go to Group conversations (link in the upper right)
  • This takes you to the Outlook-in-a-browser view of the Group
  • In the upper right of the screen, click on the ellipses (…)

  • Click on Edit group

 

Now, if I could only choose the color for the Group! I’m sure that setting is somewhere, too. Any ideas?

Cold Calling Doesn’t Work, Nor Does “Cold Emailing”

Here’s a new one in my email inbox this morning: “As per my discussion with you receptionist, I have enclosed…” Yeah, my receptionist, which I don’t have.

That was in an email from a company some would consider “legitimate” in the SharePoint space. They have a set of products for SharePoint that may work well (I have no first hand knowledge), but it doesn’t matter. By sending me that come-on via LinkedIn mail they are guaranteeing that I will actively stay away.

People, cold calls don’t work! It doesn’t matter whether you send them via LinkedIn, email, voice mail, whatever. Scatter-shot approaches to sales and marketing in the 21st century just can’t yield enough value to continue doing it.

Cold-CallingFrom “Why Cold Calling Is A Waste Of Time (And What You Should Be Doing Instead)“:

 A little internet surfing revealed that the stats for cold calls were not encouraging:

And that’s for cold calls in the traditional sense: picking up a phone and dialing a number. Email response rates are so much lower.

Unfortunately, sending bits is way too cheap. The bad guys have figured that out. Just a sampling from my Junk E-Mail and Spam folders this morning:

RE: TO WHOM IT MAY CONCERN: Sir/Madam, My name is Brown Morgan, Esq. I am a Barrister, Solicitor and Financial Advocate based in the Republic of Ghana West Africa. I brought a Business Deal at your doorstep for your consideration and hereinafter to confirm if you will be willing and interested to participate in the Business Deal. My client has privately acquired the sum of US$88 million and whereas need someone that is trustworthy to receive the aforesaid funds on condition that my client’s information will not be disclosed as the Original Owner of the Funds. Send me your telephone numbers for discussion of this offer in full details including your commission for your participation. Yours Truly, Brown Morgan. Barrister-At-Law

Have you been searching for a Business loan, Company loan or loan to pay off bills? This is to inform you that We Offer all kinds of loans at 3% interest rate.

Mr. Edgar Walker of compensation and finance house, as he is our representative in United State, contact him immediately for your Compensation payment of $500,000.00 USD (Five Hundred Thousand United States Dollars) Funds will be release direct to you in accordance with legal clearance and procedure.

Рассылки по любым предприятиям  Большой выбор аудиторий  Обращайтесь по любым вопросам: (Ч 9 5 ) 54 5   1 4 92

No idea on that last one. Am I likely to dial that phone number? Ever?

Blasting out thousands or even millions of emails has about the same cost as sending out one: almost nil. Therein lies the problem that marketers today face. There’s too much noise and chaff and it’s too easy to do the wrong thing.

After I attend a conference, something similar happens. I get a slew of emails saying things like:

  • “Thanks for stopping by our booth” when I haven’t stopped by any booth at all
  • “We enjoyed the conversation we had with you about our products” when I didn’t talk to a single person at that company
  • “Because you attended conference XYZ, we’re sure you’d be interested in…” even when there’s no connection to what I actually do in my business

The “legitimate” marketers are just riding the “free bits” tide. There’s no shortage of articles out there with titles like “5 Secrets to Cold Calling Success” or “Secrets To Successful Cold Calling”. Those articles are the cold calling of the blog post world, trying to suck you into following a practice that the writer can profit from. That’s an even more circuitous cold calling approach that probably leads to an even *lower* success rate.

Looking forward to having a long lasting business relationship with you and your Organization.

If I thought you had the least idea about who I am or what my organization does, maybe, just maybe I might read your email.

I’ll leave you with a few last thoughts on this. Do you want to contact people who may feel the way I do about it and even take the time to rant about it as I’m doing here? Or do you want to carefully seek out people who truly might buy your product or at least listen to your pitch? In this age, your “social presence” is based on the sum of every one of the interactions you have with potential customers, no matter how inconsequential those interactions may seem. How do you want your potential customers to think of you?

</rant>

"An Outlook Address Book entry cannot be used as an e-mail address in a contact."

SNAGHTML16655b5e

Um, yeah. It’s almost impossible to figure out what this means. I was trying to move an email address in an existing contact in Outlook 2010 from the E-mail slot to the E-mail 2 slot  and this gem popped up when I tried to paste it.

Turning to Bing, nothing of any use.Google, much the same. However, I found questions on this at least back to 2004 with Outlook 2003. So what’s going on?

Well, I have no idea, really, but here’s the fix that worked for me. First, I copied the existing email address from the E-mail slot into the Notes field for safekeeping. Then I updated the E-mail slot with the new email address I wanted to add and saved the contact. Next I opened the contact up again, copied the old email address out of the Notes field and pasted it into the E-mail 2 slot. This time I was allowed to past the old email address in.

I tried all sorts of variations on this, and what I described above was the only one that worked, but that doesn’t mean that there isn’t some smarter way around it. Frankly, I’m not sure why it works, but it does.

Another one for the “I just wasted a bunch of time so you don’t have to” bucket.

Comcast Email Woes – Part Two (And Final?)

Image representing Comcast as depicted in Crun...

Image via CrunchBase

You just knew that there would be at least one more post on this, didn’t you? I certainly did, thus the Part 1 (Probably) on the last one.

For those of you who don’t read every single one of my posts (shame on you), I had been having trouble sending email to my wife’s Comcast email account for about a week. I contacted Comcast to try to figure out why and had a less than satisfying experience so I decided to post about it. Well, as of yesterday, things seem to be back to normal. Of course, I haven’t heard anything at all from Comcast, nor do I really expect to. So problem solved, I guess, and me none the wiser.

One thing I didn’t mention in my other post was the great experience I had with my email provider, FPWeb.net on this, as well as any other things like this. Whenever I put in a ticket with FPWeb, I get fast, helpful responses. No, they can’t always solve everything instantly, but that’s the way the world works. The point is that they try hard, they are pleasant about it, and they get it done. That’s why when the guys over at FPWeb told me that they thought the issue was on the Comcast end, I believed them.

In fact, when I wrote the first post and let them know about it (just because I thought they would get a kick out of it) Eric at FPWeb took it upon himself to fill out the Comcast form that “Roselyn” sent me to (http://www.comcastsupport.com/Forms/NET/blockedprovider.asp) as well, just in case it might help.

I can’t say much for Comcast on this one, but as usual, I’ll recommend FPWeb. I use them for both my Exchange-based email and my SharePoint (WSS 3.0) hosting, and they are great. And no, I’m not getting anything for saying this; I’m just a happy customer. Given that I’m a one-man band, they certainly don’t have to pay as much attention to me as they do. But they do, and that matters a lot.