Email ebooks to kindle from the command line

Books

There are various ways to send an ebook to a kindle, I use a tiny script. The only tricky part is to set the correct content type. You can get your kindle email address from your devices list on amazon.

Don't forget to whitelist your from address in your Amazon settings either, or else it will never reach your device.

Raw
#!/usr/bin/env bash

MAIL="<your address>@kindle.com"

while [ -n "$1" ]; do
        if [ -z "$1" ]; then
                echo "Submit file to kindle"
                echo "Usage: kinde.sh <ebook>"
                exit 1
        fi

        echo "Sending $1 to ${MAIL}"
        echo "$1" | mail --content-type "application/x-mobipocket-ebook" --attach "$1" --subject "$1" "${MAIL}"
        shift
done

0 comments

Start a new thread

Cancel reply
Markdown. Syntax highlighting with <code lang="php"><?php echo "Hello, world!"; ?></code> etc.
DjangoPythonBitcoinTuxDebianHTML5 badgeSaltStackUpset confused bugMoneyHackerUpset confused bugX.OrggitFirefoxWindowMakerBashIs it worth the time?i3 window managerWagtailContainerIrssiNginxSilenceTorWorldInternet securityFontGnuPGThunderbirdJenkins