If you are a regular here, you may have noticed that our forum  has moved from a google groups forum to a Google+ community.

I had never noticed before, but there is a groups  service in Apps Script that allows you to access things about that group, including the members. Using this allowed me to send a note to all forum members about this change. Here’s how

Using the groups service

This is real straightforward. Assuming you are an administrator of the group, all you need is the email address of the group, and this function will give you an array of email addresses of everyone in the group. Note also that i’m only taking a chunk of emails at a time. This is because the MailApp service has a quota of people to whom it can email each day, so I’m running this over a period of a few days.

Using the MailApp service

I wanted to send a customized email to each one, so once the message has been formatted, sending them is just this

The email template with html service

I can use Html Service to render a formatted email from a template. I didn’t bother with formal templating for this trivial task – I’m simply going to push each email address into a DOM element to personalize.
Here’s my template index.html

Running the GAS functions from the html service

This little JavaScript snippet – emails.js executes each of .GS functions (get and send emails).
It’s worth a few words on google.script.run(). I need to orchestrate 2 of these, and they run asynchronously. In a normal app I would have used ES6 Promises along with a shim for older browsers, but caja doesn’t like them, and I didn’t want to bring in jQuery just for that, so you’ll see that runGooglyThingy() takes an optional additional argument of what to run next. This is pretty simple way of orchestrating asynchronous tasks if you don’t have Promises available.
That’s all. If you got one of these emails, that’s how you got it. If you didn’t why not head over to the desktop liberation google plus community and join up.

Here’s the completed code.js