Skip to content

Instantly share code, notes, and snippets.

@mjradwin
Created December 5, 2016 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjradwin/8d6300c35ee69379e70666896f6dcb2a to your computer and use it in GitHub Desktop.
Save mjradwin/8d6300c35ee69379e70666896f6dcb2a to your computer and use it in GitHub Desktop.
calibre-news-email.sh
#!/bin/sh
RECIPE="$1"
OUTFILE=`mktemp /tmp/news.XXXXXXXXXX.mobi`
ADDRESS="example_1234567@kindle.com"
# uses heirloom-mailx on Ubuntu which supports -a for attachments
/opt/calibre/ebook-convert \
"$RECIPE.recipe" $OUTFILE --output-profile kindle && \
echo "Attached is the $RECIPE periodical downloaded by calibre" \
| mail -s "News: $RECIPE" -a $OUTFILE $ADDRESS
rm -f $OUTFILE
@mjradwin
Copy link
Author

mjradwin commented Dec 6, 2016

First, we need to install the base libs for Calibre:

sudo apt install xfce4

Then, follow the binary install instructions at https://calibre-ebook.com/download_linux

Then, set up your postfix and heirloom-mailx so you can actually deliver mail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment