Last active
December 10, 2015 19:38
-
-
Save iley/4482490 to your computer and use it in GitHub Desktop.
Script to send books from a directory to kindle e-mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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