#!/usr/bin/perl # # sendfile.pl - send files to a recipient via MIME email # Copyright (C) 1998 Steven Pritchard # Use, modification and distribution is allowed without # limitation, warranty, or liability of any kind. use strict; use FileHandle; use MIME::Lite; if ($#ARGV<1) { print "usage: sendfile
[ [...]]\n"; exit 0; } my $msg=new MIME::Lite 'To' =>shift, 'Subject' =>'file transfer', 'Type' =>'multipart/mixed'; my $file; foreach $file (@ARGV) { if (!-e $file) { print STDERR "$file does not exist, skipping...\n"; } else { attach $msg Type =>'application/octet-stream', Encoding =>'base64', Filename =>&basename($file), Path =>$file; } } #my $mail=new FileHandle "|/usr/sbin/sendmail -t"; #$msg->print($mail); $msg->send(); sub basename { my($file)=@_; my @foo=split('/', $file); return $foo[$#foo]; }