Mail Epub to Kindle

Yen-Nan Lin

Kindle is the most popular e-book reader. However, it is weird that kindle doesn’t support epub format, one of popular e-book format. Hence we need to manually convert epub files to mobi format, and transfer the converted e-books to kindle by email or USB.

There are already a few online converters to repack epub to mobi format. However, we need to upload files to the converters, wait for conversion, download mobi files, upload mobi files to email and send the email to kindle. It is redundant to upload, download and upload files. In addition, you need to spend your time to wait for these processes, so I use Rails to build an app to simplify these processes.

screenshot-mail-epub-to-kindle

screenshot of mail epub to kindle app

New process is to enter kindle email address and upload your file. That’s all. Try it!

The app would convert epub file, and automatically send converted e-book to your kindle. You don’t have to wait in front of computer anymore. The files and mail address would be deleted after mail sent. However, it is little painful at first time. You need to add a email to your kindle trusted email list, but you don’t need to do it again.

Key techniques:

  • Front-end framework and icon: materialize-sass, font-awesome
    A beautiful front-end framework based on Google’s material design. Icon of the app is from font-awesome.

  • epub to mobi converter: kindlegen
    Kindlegen may be the best epub to mobi converter, as I know. Interestingly, Amazon develops it. I still have no idea why kindle can’t support epub format.

  • Background job: sidekiq, redis-to-go, puma
    I use ActiveJob with sidekiq to isolate time-consuming or delayed processes. In this app, conversion, mailing and task deletion are all executed by background job.

  • Mail: sendgrid
    It is one of the most popular email services. Heroku provide 400 free emails everyday.

  • Copy by click: zeroclipboard-rails
    For better user experience, I would like to provide as simple as possible way to copy the email address. However, due to security restrict, it is impossible to achieve this function by pure javascript. The zeroclipboard is the best choice to combine flash and javascript to copy text only by click.

  • State machine: ActiveRecord::Enum, AJAX
    Due to background jobs, tasks would be decomposed like pipeline. To easily control the process, I use ActiveRecord::Enum as a simple state machine, and after upload file, users could keep update of the task by AJAX polling.

state machine with ajax

state machine with ajax

Links: