Automated Bookmarking to Kindle via forlater.email

If you haven't tried it out, forlater.email is a great service for getting readable web content. It's like many other "read later" services in that it takes a web article and turns it into readable text. But unlike other, forlater.email is based on email.

forlater.email

To use it, simply send an email to a specified email address with the body being the link you want to read, and the service emails you back readable versions in plain text and HTML. Simple. I love services like this; being based on email just makes it so much more flexible than the web counterparts.

Kindle reading

However, I like to read on my Kindle. It makes it easier to dig into a long article without giving into distractions. Fortunately you can send content to your Kindle via email address. Simply send the thing you want to read (in a few formats) to a special provided email address and it will send it to your Kindle.

Send To Kindle

It just so happens that the plain text version of articles created by forlater.email is perfect on the Kindle. However, getting it there is a few steps. Depending on your email client it can be difficult to save the plain text copy however.

Lucky it works well with Mutt. You can go in, save your attachment, then compose a new message to your Kindle email address with the article's plain text copy.

Automation

Being who I am, I didn't want to go through all of these steps every time. It took some work, but I was able to create a script which does the job for me. The first thing you'll need that you might not have is ripmime.

ripmime

This problem takes a MIME email and extracts it into separate files. With that I had everything I need. Here's the script:

#!/bin/bash

address="your-kindle-email@example.com"

cat | ripmime -i - -e -d /tmp/send-to-kindle/ --overwrite
title=$(cat /tmp/send-to-kindle/_headers_ | grep -e "^Subject:" |  cut -c 10-)

txtfile="$title.txt"
fullpath="/tmp/send-to-kindle/$txtfile"
mv "/tmp/send-to-kindle/textfile1" "$fullpath"

echo "" | mutt -s "Article" "$address" -a "$fullpath" --
echo "Email sent"

Replace address in the script with your Kindle email address. This script takes the email from stdin, breaks it apart to a temporary folder, extracts the name of the Subject and makes that the filename, then uses mutt to send an email to your Kindle address.

You can run this via the Pipe option in Mutt, or use this macro which makes <Escape>h a shortcut for doing it all in one go.

macro pager "\eh"    "<pipe-message>send-to-kindle<enter>"

And that's it, with this I can save articles from anywhere, and then later when back at my computer send them to my Kindle.