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

In reply to (jcwren) Re: trying to attach with MIME::Lite by jcwren
in thread trying to attach with MIME::Lite by csorensen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.