Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

(jcwren) Re: trying to attach with MIME::Lite

by jcwren (Prior)
on Jul 01, 2000 at 03:38 UTC ( [id://20696]=note: print w/replies, xml ) Need Help??


in reply to trying to attach with MIME::Lite

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://20696]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-20 00:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found