How to Add a Subscription Service to Your Blog

I used to use a service to email subscribers updates to my blog. The service broke, but I automated my way around it.

I was using that well-advertised, monkey oriented mail service until this week. I used it originally based on the advice of Julia Evans. For better or worse I never actually got it to work. When I set up the cache busting for my blog the service apparently, finally noticied that I had been writing posts, but instead of sending to my incredibly small list of subscribers, they decided that I had somehow violated their ToS (they didn’t offer how and haven’t responded to my inquiries about that.)

Initially I figured I’d just cancel the service and stop having a mailing list; that worked for the prior ten years, do I really need people to subscribe via email anyway? But a few people at work acted interested and I realized: I know how to send email already! So I did what I tend to do: I wrote a program!

You can see the source here. The core of it is three basic ideas:

  1. I can get posts published in the last week using q
  2. I can easily create email using Email::Stuffer
  3. I already run postfix so enqueuing a bunch of email is as easy as calling ->send

The code could be a touch neater, by using a template, for example, instead of manually generating the email bodies, but I kinda hate template languages and don’t want to use them in my personal code unless I really have to. On top of that I want to add some fun, weird things like randomized greetings. Dominus put a bunch of stuff like that in a project at work and it has really inspired me to make fun little bits for my programs too.


I’m sure that I’ll regret this at some point, but as it stands this works fine. If one day I need to do something less scrappy I will likely use SES, Lambda, and S3. The code could be pretty similar but I’d want to port it to Go to use an official AWS SDK.


Do you want to try to have better habits or kill worse ones? Check out Atomic Habits, it’s pretty good!

Another book that I recommend is The Unix Programming Environment. It goes through the motions of creating wrappers tools and tools afresh, diving into some of the operating system details that assist the toolmaker so much.

Posted Thu, Mar 7, 2019

If you're interested in being notified when new posts are published, you can subscribe here; you'll get an email once a week at the most.