Skip to content

Instantly share code, notes, and snippets.

@iley
Last active December 10, 2015 19:38
Show Gist options
  • Select an option

  • Save iley/4482490 to your computer and use it in GitHub Desktop.

Select an option

Save iley/4482490 to your computer and use it in GitHub Desktop.
Script to send books from a directory to kindle e-mail
#!/usr/bin/env perl
use Cwd 'abs_path';
use File::Basename;
use strict;
use warnings;
my $to = '[email protected]';
my $path = abs_path($0);
my $mutt_cfg = dirname($path) . "/robot.muttrc";
for my $file (glob("~/Dropbox/tokindle/*")) {
my $subj = basename $file;
my $body = 'The book is in attachment';
system "echo '$body' | mutt -F '$mutt_cfg' -a '$file' -s '$subj' -- $to";
$? == 0 or die "Could not send file";
unlink $file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment