Automatically send document to Kindle in Ubuntu

I've discovered a way to automatically send a document to my Kindle under Ubuntu. This should work with any reasonably modern version running Gnome and Nautilus.

Step 1

This procedure requires installing the sendemail package. Find it in the Ubuntu Software Center.

Step 2

Create a new text file. If you're using a standard STMP mail delivery server, paste this text into the file:

#! /bin/bash
# Depends on package sendemail
sendemail -f YOUREMAILADDRESS -t KINDLEUSERNAME@free.kindle.com -u "Convert" -m "Sent automatically by sendemail." -s YOURMAILSERVER:PORTNUMBER -xu USERNAME -xp PASSWORD -a "$1"

Replace YOUREMAILADDRESS with your email, KINDLEUSERNAME with your Kindle username (so that the free.kindle.com address is valid), replace YOURMAILSERVER with the address of your SMTP mail server (if you don't know what this is contact your administrator, or get the info from your ISP's email setup instructions; it'll probably be an address with a name like smtp.yourispname.com), replace PORTNUMBER with the number of the server's communications port (probably 25 if not otherwise stated), and replace USERNAME with your email username and PASSWORD with your email password.

If you're using Gmail, then paste this instead:

#! /bin/bash
# Depends on package sendemail
sendemail -f YOUREMAIL@gmail.com -t KINDLEUSERNAME@free.kindle.com -u "Convert" -m "Sent automatically by sendemail." -s smtp.gmail.com:587 -xu YOUREMAIL@gmail.com -xp PASSWORD -a "$1"

Replace both YOUREMAIL with your Gmail username, KINDLEUSERNAME with your Kindle username (so that the free.kindle.com address is valid), and PASSWORD with your Gmail password.

If you're using a different webmail, make sure that your provider allows sending via SMTP. Check to see if your webmail provider supports using client software to send messages. If it does, then it almost certainly has a SMTP server you can use.

In either case, it is important that your email address is registered for sending mail to your Kindle; go to your My Kindle page (http://www.amazon.com/myk/) to make sure the email address you supplied to the script is listed.

When this is done, same the file as "Send To Kindle" (without the quotes).

Step 3

Close the file, then right-click it and select Properties. On the box that appears, click the Permissions tab and then check the box labeled "Allow executing file as program".

Step 4

Open your home directory in Nautilus (often called File Manager in Ubuntu). Under the view menu, select to view hidden files, then scroll down until you find the .gnome2 folder. Enter that, then enter the nautilus-scripts folder inside it. Copy the script your created into this folder.

You should be all set up now. Right-click a file you want to send, then go under the Scripts menu and select Send To Kindle. If all goes well and your Kindle is connected via Wi-Fi it should appear on your Kindle, converted to its native format, within a few minutes. If your Kindle is sleeping (showing the screensaver) it probably won't receive the file until it's woken up.

The script sends the file to the free conversion address at free.kindle.com. If you have a 3G Kindle and don't mind paying the 15 cents (minumum) delivery fee, you can remove the "free." portion of the script.

Amazon's Kindle translation feature works on several popular file formats, including text, Rich-Text Format, Microsoft Word, HTML (save page as "complete" in your browser), PDF, Mobipocket and common internet graphics formats. Amazon will reject the file, sending a notice to your email address, if it's not one of those formats, or if it was too large.

If you can't get this to work, try troubleshooting by changing the "KINDLEUSERNAME@free.kindle.com" portion to your email address. The script should send the file to your email instead of Amazon's conversion service. If you don't receive it you'll know there's a serious error in the script; try starting the steps over from the beginning. What you should get is a message with the subject line "Convert" and the item you wanted to send as a file attachment.