Convert and send ebook to kindle

1 minute read

I have been using kindle for several years and used the GUI version of Calibre to convert ebooks then using Thunderbird to send the converted ebook to my kindle account.

After using mutt, I write a script on my Debian Laptop to convert and send ebook to my kindle on the spot.

  • Debian
  • Mutt with Gmail
  • Calibre

Install and configure Mutt

Please see this post: Use Mutt As Email Manager

Install Calibre

It is in Raspbian repositories:

sudo apt-get install calibre

The command to convert an “.epub” ebook to “.mobi”:

ebook-convert myebook.epub"

Bash script that can convert and send epub to my kindle on the spot

nano /home/pi/

Change the content of the file as following:

#this cript will convert and send epub to my kindle on the spot
#copy the script to /usr/bin to make it global
current_file=$(echo $raw_file | tr ' ' '_')

#remove spaces
#mv $raw_file".epub" `echo $current_file".epub" | tr ' ' '_'`
mv "$raw_file".epub"" "$current_file".epub""

#convert all epub file and send it to kindle
ebook-convert $current_file".epub" $current_file".mobi" && mutt -s "all mobi" -a $current_file".mobi" -- < /home/pi/text

#rm  .epub files - must; remove .mobi files - optional
rm $current_file".mobi"

Note: change “” to your account accordingly.

Copy the script to /usr/bin to make it global.

sudo cp /home/pi/ /usr/bin

To use it:

Suppose I have an ebook name myebook.epub on my /home/username/. To convert and send it to my kindle: home/username/myebook.epub

Leave a comment