Building an email newsletter: easy, fun, cheap
February 2, 2018
I’m a big fan of email newsletters. They make it really easy for fans to stay in touch with projects they enjoy, without having to be subjected to the whims of some social media algorithm. With an email newsletter, everything is much more direct and personal: “you want to hear about my projects? Great! I’ll send you an email when something interesting happens.” It’s a beautiful system, with no outside parties manipulating your fans or trying to sell their data.
Historically, though, you’ve had to choose between ‘easy’ and ‘cheap’ when it came time to send email. Going it alone (cheap) meant setting up your own mail server and contending with deliverability pains and infrastructure maintenance. On the easy side, MailChimp has a nice free tier, but when you reach 2000 subscribers they immediately hit you with some pretty significant fees. This is understandable, since they’re focused on selling to businesses, but it’s not ideal if you just want to keep some people informed about your side projects.
So if you’re not willing to monetize your audience, what do you do? There are a few options, but I’m going to walk you through what I ended up doing to build refinery.news, a daily email I put together as a fun side project.
First, I want to be clear that this project was (and still is) not free, it’s just very cheap. If you’re looking for free email newsletter automation, I don’t know what to tell you.
Now that that disclaimer is out of the way, Here’s the summary of my solution:
I used Amazon SES, a Lambda function, and an off-the-shelf piece of software called Sendy (fyi: this and several of the links below are affiliate links. Any funds I receive will go toward future projects like this) running on an AWS t2.micro instance. AWS SES costs 10 cents per thousand emails sent, which is crazy cheap. It’s just an API to send transactional email through a great service, though, so you need some way to maintain email lists and gather statistics. Sendy does that -- it’s a one-time purchase of $59, and you have to run it on your own server. I run my copy on a t2.micro instance, which costs me about $8.30 a month. I did find a nice-looking open-source alternative to Sendy called “Mail for Good”, but I didn’t end up trying it because it didn’t appear to have an API. I wanted to send out programmatic emails (I built a curation algorithm that would send me interesting articles every day) so I needed some way to programmatically generate campaigns.
That’s the quick version. Here are all the gory details of using my setup, if you’re interested:
- Buy a domain. If you own one already, that’s great, you just need to be able to add to your DNS records. I bought refinery.news through AWS, because I like using Route 53 to easily manipulate domain records.
- Set up an ec2 instance to run your copy of Sendy (or Mail for Good, or whatever other management software you’d like to use). If you’re not familiar with setting up a server with a static IP, check out this great guide from the folks over at freeCodeCamp.
- If you’re using Sendy, set up the environment for it first by installing Apache, MySql, and PHP (I know, I feel it too) on your base Ubuntu image, and then follow the Sendy installation guide.
- Verify your domain via the AWS SES console. AWS will walk you through setting up DKIM, which is an important email authentication method designed to detect email spoofing. For you, it involves setting up specific CNAME DNS records.
- Point your MX records to some email provider so that you can communicate with your audience. I use G Suite and pay $5/month for it (this is also an affiliate link). They have great guides that will walk you through adding MX records.
- If you want to host a cheap static landing page to obtain email signups (like, nearly free), set up an S3 bucket to do static hosting. That’s what I did for News Refinery. Here’s a great guide for that. You’ll also have to an an A record to use your own domain. The guide covers that as well.
- In the Sendy UI, first sent up a ‘brand’ and then set up your email list. On the email list page there will be a ‘subscribe form’ link, which will give you the HTML for a sign-up form. Paste that into your static site, and style to your liking! You may want to change your email list settings to enable double opt-in and to change your sign-up page redirects. If you'd like a nice, simple logo, you can do what I did and use Logojoy. You’re all ready to send out email campaigns.
- Finally, if you want to send out programmatic emails, use the ‘create and send campaign’ endpoint in the Sendy API . I wrote a script that finds five interesting articles every day, mainly (but not exclusively) focused on science, engineering, and technology subjects. I put that script up in an AWS Lambda function, and then used an AWS Cloudwatch event to trigger the Lambda every day. It should cost less than a cent per year to run.
This setup has worked well for me so far, but I’m not sure how the Sendy server will handle large spikes at the ‘subscription’ endpoint. I’d like to do more testing there. Ultimately it would be awesome if someone put together an email newsletter application that runs 100% on AWS Lambda -- this seems like a perfect use case, considering the spiky nature of subscribes and sends. I may put something like that together in the future if I’m ever looking for a bigger project.
That’s it! Now go forth and create a newsletter that will make someone’s life better.
If you'd like to be notified about future posts, feel free to join my mailing list!