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).
- Hazel. Download and purchase it. It’s worth it.
- sendemail. Install with homebrew -
brew install sendemail. Done!
Open up Hazel’s preferences, select the Downloads directory, and add a new rule:
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 email@example.com firstname.lastname@example.org \ -f email@example.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
When you download a mobi file it will (semi-)instantly delivered to your kindle-capable devices. Voilà!