Writing

Software, projects & software projects

My mail-driven reading list

For my first blog post I want to talk about the reading list I built for myself. The list itself can be found here.

The Problem

The issue at hand is old and is already solved a million times: Collect a list of interesting articles, blog posts and "long reads" into an easy to access way. I do most of my reading on my phone using Safari's awesome Reader View. On my "desktop" devices, a Windows PC, a private Macbook and a company Macbook, I mostly use Chrome. Simply keeping bookmarks across platforms was out of the picture; for me bookmarks have a short shelf-life. I want a location to store things for the long term, mainly to see "what I've read this year", but also to revisit some articles or recommend things to friends and colleagues. As I'm reading mostly on my phone, I want to be able to easily add links from there.

The Solution

So I did what any sane human would do: I threw together a bunch of unrelated technologies. What came out is a weird, but somewhat reliable and easy to use solution. A quick google search lead me to the Amazon Simple Email Service. SES allows you to receive mails by setting up "rule sets". With rules sets you can define actions which are triggered once an e-mail arrived to one of the rule set's recipients, e.g. you can forward the mail into a SNS topic or call a lambda function. I opted to store received messages into a S3 bucket. This setup allows me to just send the links I want to store to a predefined address, which in turn persists the mail into S3. All you basically need for this is a domain you own: Setting up e-mail reception includes adding some DNS TXT records in order for AWS to verify your domain.

Generating the reading list is easy enough:

  1. Fetch received messages from S3
  2. Parse the mails using mailparser
  3. Fetch the actual URLs from the body using this awesome regex:
    https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
  4. Use the mail subject lines as titles for list entries
  5. Render a single HTML file using a pug template
  6. Deploy the new reading list to Vercel static hosting (formerly Zeit)
These steps run within a hourly scheduled cron job on a Raspberry Pi, which normally acts as my local ad-blocker using pi-hole. This setup hasn't failed since I hacked it together and the AWS parts are only using the available free tiers of S3 and SES.

I can now just "send myself a mail" from my phone using the iOS sharing menu to bookmark a link. By using the subject line I can control the title of the entry and easily add hints like "(video)" or "(pdf)" to respective links. The Gmail app includes the link to the article into the mail body per default.

That's it, let me know what you think!

Other posts