01 #!/usr/local/bin/perl -w 02 use strict; 03 use MIME::Lite; 04 05 my( $file ) = @ARGV; 06 07 if( !defined $file ) { 08 die "usage: $0 file.mobi"; 09 } 10 11 my $msg = MIME::Lite->new( 12 From => 'm@perlmeister.com', 13 To => 14 'Gaxy Galaxy xxx@Kindle.com>', 15 Subject => 'My Ebook', 16 Type => 'multipart/mixed' 17 ); 18 19 my $part = MIME::Lite->new( 20 Type => 'text/plain', 21 Data => "some text\n", 22 ); 23 24 $msg->attach( $part ); 25 26 $msg->attach( 27 Type => 'application/mobi', 28 Path => $file, 29 Filename => $file, 30 Disposition => 'attachment', 31 ); 32 33 $msg->send( 'smtp', 'mail.some-smtp.com' );