# Following obtained from internet discussion
# Not yet tested by myself
use Net::SMTP;
use MIME::Base64;
my $file = 'test.doc';
my $mediatype = 'msword';
open INPUT, $file or die "Can't open INPUT file $file: $!\n";
binmode INPUT;
my $buffer;
my $from = 'abc@email.com';
my $to = 'abc@email.net';
my $server = 'smtp.server.com';
my $time = sprintf ("%x", time);
my $smtp = Net::SMTP->new($server) or die "Can't create SMTP object\n";
$smtp->mail($from);
$smtp->to($to);
my @msg = <data();
$smtp->datasend(@msg);
$smtp->datasend(encode_base64($buffer)) while(read (INPUT,
$buffer,60*57));
$smtp->datasend("\n--Boundary $time--\n");
$smtp->dataend();
$smtp->quit();
#
close INPUT;