Skip to content

Instantly share code, notes, and snippets.

@duongkai
Created April 2, 2013 18:48
Show Gist options
  • Save duongkai/5295033 to your computer and use it in GitHub Desktop.
Save duongkai/5295033 to your computer and use it in GitHub Desktop.
This script will send a specified book to your Kindle App
# version 0.1
# this script will send a particular book to my kindle app
require 'gmail'
if ARGV.length != 1
puts "Wrong syntax. $SendToMyKindle.rb <path_to_book>"
abort "Wrong input"
end
sending_book = ARGV[0]
EMAIL = 'lienxo_my_la_doi_ban_than@gmail.com'
PWD = 'neptune'
KINDLE_EMAIL = 'neptune123@kindle.com' # The kindle email associcates with my Nexus 7 kindle
Gmail.new(EMAIL, PWD) do |mail|
mail.deliver do
to KINDLE_EMAIL
book_title = File.basename sending_book
subject "Sending book #{book_title} to my Nexus 7"
add_file sending_book
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment