I’m currently serving a three-year term as the publicity chair for ICFP. Like many conferences, we use a Gmail account for sending publicity emails. If you’ve seen any messages on mailing lists from icfp.publicity@googlemail.com, those came from me (or David Van Horn before me, or Wouter Swierstra before him, or Matthew Fluet before him).

Serving as publicity chair involves sending a lot of mail, and I quickly found that sending a message to a bunch of lists via Gmail usually ended up being painful in some way or another. I couldn’t just use bcc, because many lists will reject bcc’d emails, and I didn’t want to have to use a paid service to handle this seemingly simple task. I tried various Gmail and Google Sheets add-ons and plugins that promised to make it possible to send bulk mail, but none of them seemed to reliably work right – they’d hit a rate limit, fail mysteriously, or, worst of all, turn my plain-text messages into rich text. I always ended up having to send at least a few of the messages manually, and once I had to apologize for sending a mangled rich-text message to a bunch of lists.

I complained about this situation to Alex, and he pointed out that Gmail supports IMAP access, and that therefore, instead of relying on flaky plugins, I could just write my own script to send bulk mail. It was one of those “Oh, right; I’m a programmer” moments. I found ruby-gmail, a Ruby gem. I’m no Rubyist, but it has an excellent README, and it was easy to throw this tiny Ruby script together. And it works! In fact, if you received the ICFP Call for Participation message that I sent on July 19, and your mail client shows a Message-ID header, you’ll see that it ends in landin.local.maillandin being the name of my laptop.

For those of you who are concerned that I’m becoming a spammer, I used this script to send precisely thirty-eight emails to relevant mailing lists. The outcome is exactly the same as that of what I was doing before, except that now I’m not using a Google Sheets plugin that fails mysteriously after sending thirty-five of the emails, or complains that I’m hitting the rate limit even though the rate limit is supposedly 100 emails per day.

Please use responsibly, and keep in mind that in addition to enabling IMAP access in your Gmail settings, you might need to enable access to your Google account from “less secure apps” to make the authentication work. If the Google account you’re using has 2-step verification turned on, you might need to set up an app password in addition to the usual account password.

Comments