Joel Always one syllable, sometimes "@jayroh"

Auto-delivering Downloaded Kindle Books

30 Mar 2014

I will often buy self-published programming books and send them to my kindle (and iPad, and iPhone) via email. Amazon’s kindle platform will allow you to distribute documents (books) to your devices via custom email addresses. As mentioned I have three devices that I will often read from and need to send emails to those three with a downloaded mobi attachment. This is far from difficult but annoying enough that it could probably be automated. So I did.

You will need to allow an email address of yours to send the documents to kindle. Visit your kindle settings page and approve the email address you will be using (your Gmail address).

Tools necessary:

  1. Hazel. Download and purchase it. It’s worth it.
  2. sendemail. Install with homebrew - brew install sendemail. Done!

Open up Hazel’s preferences, select the Downloads directory, and add a new rule:

image

Where the embedded script looks similar to the command below. Note that the important part here is -a $1 where this interpolates the path to the mobi file and sets it as the attached file.

sendemail \
 -t your.kindle.email@kindle.com your.other.email@kindle.com \
 -f your.google.username@gmail.com \
 -u "New book" \
 -m "See attached" \
 -a $1 \
 -s smtp.gmail.com:587 \
 -o tls=yes \
 -xu your.google.username \
 -xp your_google_password

That’s it!

When you download a mobi file it will (semi-)instantly delivered to your kindle-capable devices. Voilà!

I'm working on something called shubox.io!

Want to know more about it? (Answer: "Yes. I do") Check it out or sign up for my newsletter to receive news, announcements and other good bits!