I think possibly you're misinterpeting what the
path and
file parameters are.
path is the path/name of the file on the system you're sending from.
file is the name that you want the receiver to see it as.
In the example below (your code, with the addition of "use strict;" and -w), the name of the Perl executable is
test.pl. When I run this code, I receive the e-mail with the filename of the attachment as
newname.pl. Try this code on your system (changing the names of the receiver, of course), and see if it works for you.
(Basically, the program (test.pl) sends itself to the receiver (receiver@linux.private.com), encoded as a binary attachment (named newname.pl), from sender@linux.private.com.)
#!/usr/local/bin/perl -w
use strict;
use MIME::Lite;
{
my $path = 'test.pl';
my $file = 'newname.pl';
my $receiver = 'receiver@linux.private.com';
my $new_message = MIME::Lite->new(
From =>'sender@linux.private.com',
To =>"$receiver",
Subject =>'Whitepaper request',
Type =>'multipart/mixed');
$new_message->attach(
Type =>'BINARY',
Path =>"$path",
Filename =>"$file");
$new_message->send;
}
--Chris