Send File to Kindle
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
'Send File to Kindle' lets a site's users send Kindle-supported documents to their Kindle devices. This only works on field type 'file'. It creates a custom field formatter, which must be specified for the file field in question, when creating or editing the content type.
This module requires the mail system and mime mail modules. See the README.txt for full instructions on installation and usage.
After installation each user profile will have a new field called 'Send-to-Kindle E-Mail Address'. This is the email address of the Kindle device to which the user wants documents sent. The user *MUST* go into their Amazon account and configure their Kindle device to receive emails from 'kindlemail@domain_name', where 'domain_name' is the domain of the Drupal site. The Send-to-Kindle user profile field has a description that instructs the user to do this.
When the file is displayed, that display will be identical to the 'Generic file' formatter, except there will be a button directly after it that reads 'Send to Kindle'. The button only appears if the file is a supported file type for Kindle. Click the button, and the document is sent to the user's Kindle.
For customization purposes, the module includes a template file called 'send_to_kindle_kindlebutton.tpl.php'. Copy this file to your theme directory, and you can theme and modify the the file link as you wish. The template has variables in it that let the theme create a custom link and/or control how the emails is sent.
Because the module operates by sending an email with an attachment to an email address for a given Kindle device, you may want to evaluate the module by specifying a different email address -- such as your own -- to which to send the email and attached file. By default the module does not allow a non-Kindle email address to be saved in the user profile. You can change this and allow the module to save a non-Kindle email address by going to the function below, which is in send_file_to_kindle.module and changing the line that reads '$is_good = FALSE'; to '$is_good = TRUE;'
function send_file_to_kindle_form_validate($form, &$form_state) {
$submitted_email = $form_state['values']['send_file_to_kindle'][LANGUAGE_NONE][0]['value'];
$is_good = TRUE;
// Get the domain string and convert to lower case.
$var = explode('@', $submitted_email);
$domain = drupal_strtolower(array_pop($var));
// If it's not empty and not a valid email or the domain isn't kindle.com,
// fail.
if ($submitted_email != '') {
if (!valid_email_address($submitted_email) || ($domain != 'kindle.com')) {
// Change the line below to TRUE to test with non-Kindle email addresses.
$is_good = FALSE;
}
}
if (!$is_good) {
form_set_error('send_file_to_kindle', t('Your Kindle email address is invalid. It must be a valid email and be for the domain kindle.com. You do not have to provide an email address.'));
}
}